Skip to content

Commit 73bb116

Browse files
authored
feat(parser): add ZCode SQLite sync support (#1003) (#1012)
ZCode sessions were invisible because agentsview did not have an agent type, provider, parser, or sync route for the SQLite database reported in #1003. This adds `AgentZCode` on the existing DB-backed provider path. The provider resolves either `.zcode/cli/db` or `.zcode/cli` to `db.sqlite`, reads the reported `session` and `model_usage` tables, and emits metadata-only sessions plus usage events. Freshness uses the same effective mtime for provider fingerprints and stored session file info, combining session timestamps, usage timestamps, and the SQLite DB/WAL/SHM mtimes so usage-only updates stay visible. This covers metadata and usage from the issue's reported schema. Live ZCode compatibility and transcript-message storage need a sample DB, local install, or upstream schema source. Closes #1003 Co-authored-by: Rod Boev <rodboev@users.noreply.github.com>
1 parent 4914e43 commit 73bb116

9 files changed

Lines changed: 1299 additions & 9 deletions

File tree

internal/parser/provider.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,8 @@ func providerFactoryForDef(def AgentDef) ProviderFactory {
484484
return newVSCodeCopilotProviderFactory(def)
485485
case AgentVibe:
486486
return newVibeProviderFactory(def)
487+
case AgentZCode:
488+
return newZcodeProviderFactory(def)
487489
case AgentWarp:
488490
return newWarpProviderFactory(def)
489491
case AgentWorkBuddy:

internal/parser/provider_migration.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ var providerMigrationModes = map[AgentType]ProviderMigrationMode{
5151
AgentPiebald: ProviderMigrationProviderAuthoritative,
5252
AgentWarp: ProviderMigrationProviderAuthoritative,
5353
AgentPositron: ProviderMigrationProviderAuthoritative,
54+
AgentZCode: ProviderMigrationProviderAuthoritative,
5455
AgentAntigravity: ProviderMigrationProviderAuthoritative,
5556
AgentAntigravityCLI: ProviderMigrationProviderAuthoritative,
5657
AgentVibe: ProviderMigrationProviderAuthoritative,

internal/parser/types.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const (
4646
AgentPiebald AgentType = "piebald"
4747
AgentWarp AgentType = "warp"
4848
AgentPositron AgentType = "positron"
49+
AgentZCode AgentType = "zcode"
4950
AgentAntigravity AgentType = "antigravity"
5051
AgentAntigravityCLI AgentType = "antigravity-cli"
5152
AgentVibe AgentType = "vibe"
@@ -510,6 +511,21 @@ var Registry = []AgentDef{
510511
WatchSubdirs: []string{"workspaceStorage"},
511512
FileBased: true,
512513
},
514+
{
515+
Type: AgentZCode,
516+
DisplayName: "ZCode",
517+
EnvVar: "ZCODE_DIR",
518+
ConfigKey: "zcode_dirs",
519+
DefaultDirs: []string{
520+
".zcode/cli/db",
521+
".zcode/cli",
522+
},
523+
IDPrefix: "zcode:",
524+
FileBased: false,
525+
Usage: UsageCapabilities{
526+
NoPerMessageTokenData: true,
527+
},
528+
},
513529
{
514530
Type: AgentZed,
515531
DisplayName: "Zed",

internal/parser/types_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ func TestRegistryCompleteness(t *testing.T) {
437437
AgentPiebald,
438438
AgentWarp,
439439
AgentPositron,
440+
AgentZCode,
440441
AgentZed,
441442
AgentAntigravity,
442443
AgentAntigravityCLI,
@@ -586,6 +587,17 @@ func TestZedRegistryEntry(t *testing.T) {
586587
assert.Equal(t, "zed:", def.IDPrefix)
587588
}
588589

590+
func TestZCodeRegistryEntry(t *testing.T) {
591+
def, ok := AgentByType(AgentZCode)
592+
require.True(t, ok, "AgentZCode missing from Registry")
593+
require.False(t, def.FileBased, "ZCode FileBased")
594+
assert.Equal(t, "ZCODE_DIR", def.EnvVar)
595+
assert.Equal(t, "zcode_dirs", def.ConfigKey)
596+
assert.Equal(t, []string{".zcode/cli/db", ".zcode/cli"}, def.DefaultDirs)
597+
assert.Equal(t, "zcode:", def.IDPrefix)
598+
assert.True(t, def.Usage.NoPerMessageTokenData)
599+
}
600+
589601
func TestShelleyRegistryEntry(t *testing.T) {
590602
def, ok := AgentByType(AgentShelley)
591603
require.True(t, ok, "AgentShelley missing from Registry")

0 commit comments

Comments
 (0)