agentera 3.0.0-dev.5 → 3.0.0-dev.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/bundle/extract-corpus-parity.json +23 -0
- package/bundle/references/adapters/cursor.md +10 -9
- package/bundle/references/adapters/opencode.md +26 -26
- package/bundle/references/adapters/package-registry.yaml +0 -1
- package/bundle/references/adapters/package-surface-characterization.md +1 -2
- package/bundle/references/adapters/runtime-adapter-characterization.md +1 -1
- package/bundle/references/adapters/runtime-adapter-registry.yaml +16 -10
- package/bundle/references/adapters/runtime-feature-parity.md +2 -2
- package/bundle/references/analysis/benchmark.md +1 -1
- package/bundle/references/analysis/startup-measurement-contract.yaml +18 -18
- package/bundle/references/artifacts/artifact-registry-interface-model.yaml +4 -3
- package/bundle/references/cli/agent-ready-state-contract.yaml +6 -6
- package/bundle/references/cli/app-lifecycle-vocabulary.yaml +4 -4
- package/bundle/references/cli/audience-namespace-cli-migration.yaml +40 -26
- package/bundle/references/cli/bundle-skill-vocabulary.yaml +1 -29
- package/bundle/references/cli/capability-tool-classification.yaml +12 -12
- package/bundle/references/cli/coexistence-probe.yaml +13 -0
- package/bundle/references/cli/parity-expected-actual-template.md +30 -0
- package/bundle/references/cli/routing-execution-vocabulary.yaml +6 -6
- package/bundle/references/cli/routing-model.md +96 -0
- package/bundle/references/cli/single-name-protocol.yaml +42 -0
- package/bundle/references/cli/trigger-schema-enrichment.md +136 -0
- package/bundle/references/cli/update-channels.yaml +16 -0
- package/bundle/references/cli/upgrade-repair-wording.md +45 -0
- package/bundle/references/cli/v3-handoff-manifest.schema.yaml +98 -0
- package/bundle/references/cli/vocabulary-index.yaml +17 -12
- package/bundle/references/cli/vocabulary.md +316 -309
- package/bundle/references/meta/documentation-inventory.md +9 -3
- package/bundle/registry.json +13 -13
- package/bundle/skills/agentera/.claude-plugin/plugin.json +13 -13
- package/bundle/skills/agentera/SKILL.md +99 -415
- package/bundle/skills/agentera/agents/audit.toml +6 -0
- package/bundle/skills/agentera/agents/build.toml +6 -0
- package/bundle/skills/agentera/agents/design.toml +6 -0
- package/bundle/skills/agentera/agents/{planera.toml → discuss.toml} +3 -3
- package/bundle/skills/agentera/agents/{resonera.toml → document.toml} +3 -3
- package/bundle/skills/agentera/agents/{optimera.toml → optimize.toml} +2 -2
- package/bundle/skills/agentera/agents/orchestrate.toml +6 -0
- package/bundle/skills/agentera/agents/plan.toml +6 -0
- package/bundle/skills/agentera/agents/profile.toml +6 -0
- package/bundle/skills/agentera/agents/research.toml +6 -0
- package/bundle/skills/agentera/agents/status.toml +6 -0
- package/bundle/skills/agentera/agents/vision.toml +6 -0
- package/bundle/skills/agentera/capabilities/{inspektera → audit}/schemas/artifacts.yaml +10 -10
- package/bundle/skills/agentera/capabilities/{inspektera → audit}/schemas/triggers.yaml +15 -6
- package/bundle/skills/agentera/capabilities/{inspektera → audit}/schemas/validation.yaml +9 -9
- package/bundle/skills/agentera/capabilities/{realisera → build}/schemas/artifacts.yaml +11 -11
- package/bundle/skills/agentera/capabilities/{realisera → build}/schemas/triggers.yaml +13 -3
- package/bundle/skills/agentera/capabilities/{realisera → build}/schemas/validation.yaml +7 -7
- package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/artifacts.yaml +6 -6
- package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/triggers.yaml +15 -3
- package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/validation.yaml +5 -5
- package/bundle/skills/agentera/capabilities/{resonera → discuss}/schemas/artifacts.yaml +6 -6
- package/bundle/skills/agentera/capabilities/{resonera → discuss}/schemas/triggers.yaml +11 -3
- package/bundle/skills/agentera/capabilities/{resonera → discuss}/schemas/validation.yaml +4 -4
- package/bundle/skills/agentera/capabilities/{dokumentera → document}/schemas/artifacts.yaml +10 -10
- package/bundle/skills/agentera/capabilities/{dokumentera → document}/schemas/triggers.yaml +14 -3
- package/bundle/skills/agentera/capabilities/{dokumentera → document}/schemas/validation.yaml +8 -8
- package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/artifacts.yaml +8 -8
- package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/triggers.yaml +11 -3
- package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/validation.yaml +7 -7
- package/bundle/skills/agentera/capabilities/{orkestrera → orchestrate}/schemas/artifacts.yaml +10 -10
- package/bundle/skills/agentera/capabilities/{orkestrera → orchestrate}/schemas/triggers.yaml +16 -3
- package/bundle/skills/agentera/capabilities/{orkestrera → orchestrate}/schemas/validation.yaml +27 -27
- package/bundle/skills/agentera/capabilities/{planera → plan}/schemas/artifacts.yaml +8 -8
- package/bundle/skills/agentera/capabilities/{planera → plan}/schemas/exit.yaml +2 -2
- package/bundle/skills/agentera/capabilities/{planera → plan}/schemas/triggers.yaml +15 -3
- package/bundle/skills/agentera/capabilities/{planera → plan}/schemas/validation.yaml +3 -3
- package/bundle/skills/agentera/capabilities/{profilera → profile}/schemas/artifacts.yaml +2 -2
- package/bundle/skills/agentera/capabilities/{profilera → profile}/schemas/exit.yaml +2 -1
- package/bundle/skills/agentera/capabilities/{profilera → profile}/schemas/triggers.yaml +7 -3
- package/bundle/skills/agentera/capabilities/{profilera → profile}/schemas/validation.yaml +2 -2
- package/bundle/skills/agentera/capabilities/{inspirera → research}/schemas/artifacts.yaml +5 -5
- package/bundle/skills/agentera/capabilities/{inspirera → research}/schemas/triggers.yaml +9 -3
- package/bundle/skills/agentera/capabilities/{inspirera → research}/schemas/validation.yaml +2 -2
- package/bundle/skills/agentera/capabilities/{hej → status}/schemas/artifacts.yaml +14 -11
- package/bundle/skills/agentera/capabilities/{hej → status}/schemas/triggers.yaml +10 -4
- package/bundle/skills/agentera/capabilities/{hej → status}/schemas/validation.yaml +5 -5
- package/bundle/skills/agentera/capabilities/{visionera → vision}/schemas/artifacts.yaml +8 -8
- package/bundle/skills/agentera/capabilities/{visionera → vision}/schemas/triggers.yaml +17 -3
- package/bundle/skills/agentera/capabilities/{visionera → vision}/schemas/validation.yaml +7 -7
- package/bundle/skills/agentera/capability_schema_contract.yaml +178 -34
- package/bundle/skills/agentera/protocol.yaml +29 -29
- package/bundle/skills/agentera/references/contract.md +328 -319
- package/bundle/skills/agentera/schemas/artifacts/changelog.yaml +4 -4
- package/bundle/skills/agentera/schemas/artifacts/decisions.yaml +9 -9
- package/bundle/skills/agentera/schemas/artifacts/design.yaml +4 -4
- package/bundle/skills/agentera/schemas/artifacts/docs.yaml +8 -7
- package/bundle/skills/agentera/schemas/artifacts/experiments.yaml +5 -5
- package/bundle/skills/agentera/schemas/artifacts/health.yaml +5 -5
- package/bundle/skills/agentera/schemas/artifacts/objective.yaml +4 -4
- package/bundle/skills/agentera/schemas/artifacts/plan.yaml +5 -5
- package/bundle/skills/agentera/schemas/artifacts/progress.yaml +5 -5
- package/bundle/skills/agentera/schemas/artifacts/todo.yaml +40 -35
- package/bundle/skills/agentera/schemas/artifacts/vision.yaml +3 -3
- package/dist/analytics/extractCorpus/cli.js +149 -0
- package/dist/analytics/extractCorpus/cli.js.map +1 -0
- package/dist/analytics/extractCorpus/copilotSessions.js +273 -0
- package/dist/analytics/extractCorpus/copilotSessions.js.map +1 -0
- package/dist/analytics/extractCorpus/core.js +364 -0
- package/dist/analytics/extractCorpus/core.js.map +1 -0
- package/dist/analytics/extractCorpus/corpus.js +145 -0
- package/dist/analytics/extractCorpus/corpus.js.map +1 -0
- package/dist/analytics/extractCorpus/coverageAudit.js +261 -0
- package/dist/analytics/extractCorpus/coverageAudit.js.map +1 -0
- package/dist/analytics/extractCorpus/cursorSessions.js +423 -0
- package/dist/analytics/extractCorpus/cursorSessions.js.map +1 -0
- package/dist/analytics/extractCorpus/extractCorpusParity.js +105 -0
- package/dist/analytics/extractCorpus/extractCorpusParity.js.map +1 -0
- package/dist/analytics/extractCorpus/filesystemSources.js +122 -0
- package/dist/analytics/extractCorpus/filesystemSources.js.map +1 -0
- package/dist/analytics/extractCorpus/index.js +12 -0
- package/dist/analytics/extractCorpus/index.js.map +1 -0
- package/dist/analytics/extractCorpus/jsonlSessions.js +185 -0
- package/dist/analytics/extractCorpus/jsonlSessions.js.map +1 -0
- package/dist/analytics/extractCorpus/sqliteCaps.js +44 -0
- package/dist/analytics/extractCorpus/sqliteCaps.js.map +1 -0
- package/dist/analytics/extractCorpus/sqliteSessions.js +368 -0
- package/dist/analytics/extractCorpus/sqliteSessions.js.map +1 -0
- package/dist/analytics/extractCorpus.js +2 -1790
- package/dist/analytics/extractCorpus.js.map +1 -1
- package/dist/analytics/usageStats.js +20 -20
- package/dist/analytics/usageStats.js.map +1 -1
- package/dist/capabilities/audit/instructions.js +6 -0
- package/dist/capabilities/audit/instructions.js.map +1 -0
- package/dist/capabilities/build/instructions.js +6 -0
- package/dist/capabilities/build/instructions.js.map +1 -0
- package/dist/capabilities/design/instructions.js +5 -0
- package/dist/capabilities/design/instructions.js.map +1 -0
- package/dist/capabilities/discuss/instructions.js +6 -0
- package/dist/capabilities/discuss/instructions.js.map +1 -0
- package/dist/capabilities/document/instructions.js +6 -0
- package/dist/capabilities/document/instructions.js.map +1 -0
- package/dist/capabilities/index.js +24 -24
- package/dist/capabilities/index.js.map +1 -1
- package/dist/capabilities/inspirera/instructions.js +1 -1
- package/dist/capabilities/inspirera/instructions.js.map +1 -1
- package/dist/capabilities/optimize/instructions.js +6 -0
- package/dist/capabilities/optimize/instructions.js.map +1 -0
- package/dist/capabilities/orchestrate/instructions.js +6 -0
- package/dist/capabilities/orchestrate/instructions.js.map +1 -0
- package/dist/capabilities/plan/instructions.js +6 -0
- package/dist/capabilities/plan/instructions.js.map +1 -0
- package/dist/capabilities/planera/instructions.js +1 -1
- package/dist/capabilities/planera/instructions.js.map +1 -1
- package/dist/capabilities/profile/instructions.js +6 -0
- package/dist/capabilities/profile/instructions.js.map +1 -0
- package/dist/capabilities/profilera/instructions.js +1 -1
- package/dist/capabilities/profilera/instructions.js.map +1 -1
- package/dist/capabilities/realisera/instructions.js +1 -1
- package/dist/capabilities/realisera/instructions.js.map +1 -1
- package/dist/capabilities/research/instructions.js +6 -0
- package/dist/capabilities/research/instructions.js.map +1 -0
- package/dist/capabilities/resonera/instructions.js +1 -1
- package/dist/capabilities/resonera/instructions.js.map +1 -1
- package/dist/capabilities/status/instructions.js +6 -0
- package/dist/capabilities/status/instructions.js.map +1 -0
- package/dist/capabilities/vision/instructions.js +6 -0
- package/dist/capabilities/vision/instructions.js.map +1 -0
- package/dist/capabilities/visionera/instructions.js +1 -1
- package/dist/capabilities/visionera/instructions.js.map +1 -1
- package/dist/capabilities/visualisera/instructions.js +3 -4
- package/dist/capabilities/visualisera/instructions.js.map +1 -1
- package/dist/cli/appContext.js +16 -17
- package/dist/cli/appContext.js.map +1 -1
- package/dist/cli/capabilityContext/benchmark.js +564 -0
- package/dist/cli/capabilityContext/benchmark.js.map +1 -0
- package/dist/cli/capabilityContext/bespoke.js +36 -0
- package/dist/cli/capabilityContext/bespoke.js.map +1 -0
- package/dist/cli/capabilityContext/build.js +177 -0
- package/dist/cli/capabilityContext/build.js.map +1 -0
- package/dist/cli/capabilityContext/closeout.js +230 -0
- package/dist/cli/capabilityContext/closeout.js.map +1 -0
- package/dist/cli/capabilityContext/contract.js +188 -0
- package/dist/cli/capabilityContext/contract.js.map +1 -0
- package/dist/cli/capabilityContext/evidence.js +456 -0
- package/dist/cli/capabilityContext/evidence.js.map +1 -0
- package/dist/cli/capabilityContext/index.js +4 -0
- package/dist/cli/capabilityContext/index.js.map +1 -0
- package/dist/cli/capabilityContext/orchestration.js +107 -0
- package/dist/cli/capabilityContext/orchestration.js.map +1 -0
- package/dist/cli/capabilityContext/planState.js +271 -0
- package/dist/cli/capabilityContext/planState.js.map +1 -0
- package/dist/cli/capabilityContext/progress.js +103 -0
- package/dist/cli/capabilityContext/progress.js.map +1 -0
- package/dist/cli/capabilityContext/realisera.js +174 -0
- package/dist/cli/capabilityContext/realisera.js.map +1 -0
- package/dist/cli/capabilityContext/shared.js +94 -0
- package/dist/cli/capabilityContext/shared.js.map +1 -0
- package/dist/cli/capabilityContext/slim.js +108 -0
- package/dist/cli/capabilityContext/slim.js.map +1 -0
- package/dist/cli/capabilityContext/startup.js +213 -0
- package/dist/cli/capabilityContext/startup.js.map +1 -0
- package/dist/cli/capabilityContext/types.js +40 -0
- package/dist/cli/capabilityContext/types.js.map +1 -0
- package/dist/cli/capabilityContext.js +1 -2486
- package/dist/cli/capabilityContext.js.map +1 -1
- package/dist/cli/commands/appHome.js +23 -0
- package/dist/cli/commands/appHome.js.map +1 -0
- package/dist/cli/commands/backfill.js +84 -0
- package/dist/cli/commands/backfill.js.map +1 -0
- package/dist/cli/commands/capability.js +2 -2
- package/dist/cli/commands/capability.js.map +1 -1
- package/dist/cli/commands/compact.js +1 -1
- package/dist/cli/commands/compact.js.map +1 -1
- package/dist/cli/commands/doctor.js +17 -98
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/lint.js +4 -36
- package/dist/cli/commands/lint.js.map +1 -1
- package/dist/cli/commands/prime/bundleStatus.js +140 -0
- package/dist/cli/commands/prime/bundleStatus.js.map +1 -0
- package/dist/cli/commands/prime/collectOrientationState.js +156 -0
- package/dist/cli/commands/prime/collectOrientationState.js.map +1 -0
- package/dist/cli/commands/prime/orientationOutput.js +210 -0
- package/dist/cli/commands/prime/orientationOutput.js.map +1 -0
- package/dist/cli/commands/prime/routeOutput.js +50 -0
- package/dist/cli/commands/prime/routeOutput.js.map +1 -0
- package/dist/cli/commands/prime/types.js +2 -0
- package/dist/cli/commands/prime/types.js.map +1 -0
- package/dist/cli/commands/prime/v1Migration.js +39 -0
- package/dist/cli/commands/prime/v1Migration.js.map +1 -0
- package/dist/cli/commands/prime.js +11 -554
- package/dist/cli/commands/prime.js.map +1 -1
- package/dist/cli/commands/query.js +5 -2
- package/dist/cli/commands/query.js.map +1 -1
- package/dist/cli/commands/report.js +27 -10
- package/dist/cli/commands/report.js.map +1 -1
- package/dist/cli/commands/schema.js +24 -20
- package/dist/cli/commands/schema.js.map +1 -1
- package/dist/cli/commands/state/decisions.js +403 -0
- package/dist/cli/commands/state/decisions.js.map +1 -0
- package/dist/cli/commands/state/docs.js +97 -0
- package/dist/cli/commands/state/docs.js.map +1 -0
- package/dist/cli/commands/state/experiments.js +68 -0
- package/dist/cli/commands/state/experiments.js.map +1 -0
- package/dist/cli/commands/state/health.js +116 -0
- package/dist/cli/commands/state/health.js.map +1 -0
- package/dist/cli/commands/state/index.js +51 -0
- package/dist/cli/commands/state/index.js.map +1 -0
- package/dist/cli/commands/state/objective.js +69 -0
- package/dist/cli/commands/state/objective.js.map +1 -0
- package/dist/cli/commands/state/plan.js +173 -0
- package/dist/cli/commands/state/plan.js.map +1 -0
- package/dist/cli/commands/state/progress.js +47 -0
- package/dist/cli/commands/state/progress.js.map +1 -0
- package/dist/cli/commands/state/shared.js +15 -0
- package/dist/cli/commands/state/shared.js.map +1 -0
- package/dist/cli/commands/state/todo.js +121 -0
- package/dist/cli/commands/state/todo.js.map +1 -0
- package/dist/cli/commands/state.js +7 -7
- package/dist/cli/commands/state.js.map +1 -1
- package/dist/cli/commands/validate.js +50 -100
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli/commands/verify.js +1 -1
- package/dist/cli/commands/verify.js.map +1 -1
- package/dist/cli/contracts/bundleStatus.js +2 -0
- package/dist/cli/contracts/bundleStatus.js.map +1 -0
- package/dist/cli/contracts/orientationState.js +2 -0
- package/dist/cli/contracts/orientationState.js.map +1 -0
- package/dist/cli/dispatch/argvParser.js +33 -0
- package/dist/cli/dispatch/argvParser.js.map +1 -0
- package/dist/cli/dispatch/check.js +328 -0
- package/dist/cli/dispatch/check.js.map +1 -0
- package/dist/cli/dispatch/commands.js +27 -0
- package/dist/cli/dispatch/commands.js.map +1 -0
- package/dist/cli/dispatch/index.js +182 -0
- package/dist/cli/dispatch/index.js.map +1 -0
- package/dist/cli/dispatch/lifecycle.js +597 -0
- package/dist/cli/dispatch/lifecycle.js.map +1 -0
- package/dist/cli/dispatch/prime.js +104 -0
- package/dist/cli/dispatch/prime.js.map +1 -0
- package/dist/cli/dispatch/shared.js +64 -0
- package/dist/cli/dispatch/shared.js.map +1 -0
- package/dist/cli/dispatch/state.js +144 -0
- package/dist/cli/dispatch/state.js.map +1 -0
- package/dist/cli/dispatch.js +1 -1293
- package/dist/cli/dispatch.js.map +1 -1
- package/dist/cli/help.js +41 -8
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/orientation/attention.js +61 -0
- package/dist/cli/orientation/attention.js.map +1 -0
- package/dist/cli/orientation/corpusCoverage.js +71 -0
- package/dist/cli/orientation/corpusCoverage.js.map +1 -0
- package/dist/cli/orientation.js +129 -78
- package/dist/cli/orientation.js.map +1 -1
- package/dist/cli/prime-blob.js +1 -1
- package/dist/cli/startupCompletenessContract.js +56 -0
- package/dist/cli/startupCompletenessContract.js.map +1 -0
- package/dist/cli/stateQuery.js +9 -2
- package/dist/cli/stateQuery.js.map +1 -1
- package/dist/cli/todoSeverity.js +19 -0
- package/dist/cli/todoSeverity.js.map +1 -0
- package/dist/core/envPaths.js +21 -0
- package/dist/core/envPaths.js.map +1 -0
- package/dist/core/git.js +43 -0
- package/dist/core/git.js.map +1 -0
- package/dist/core/jsonValue.js +6 -0
- package/dist/core/jsonValue.js.map +1 -0
- package/dist/core/pyjson.js +67 -2
- package/dist/core/pyjson.js.map +1 -1
- package/dist/eval/evalSkills.js +17 -12
- package/dist/eval/evalSkills.js.map +1 -1
- package/dist/eval/semanticEval.js +43 -19
- package/dist/eval/semanticEval.js.map +1 -1
- package/dist/eval/semanticFixtures.js +16 -4
- package/dist/eval/semanticFixtures.js.map +1 -1
- package/dist/hooks/common.js +8 -23
- package/dist/hooks/common.js.map +1 -1
- package/dist/hooks/compaction/apply.js +269 -0
- package/dist/hooks/compaction/apply.js.map +1 -0
- package/dist/hooks/compaction/dryRun.js +183 -0
- package/dist/hooks/compaction/dryRun.js.map +1 -0
- package/dist/hooks/compaction/index.js +23 -0
- package/dist/hooks/compaction/index.js.map +1 -0
- package/dist/hooks/compaction/parse.js +258 -0
- package/dist/hooks/compaction/parse.js.map +1 -0
- package/dist/hooks/compaction/retention.js +199 -0
- package/dist/hooks/compaction/retention.js.map +1 -0
- package/dist/hooks/compaction/status.js +241 -0
- package/dist/hooks/compaction/status.js.map +1 -0
- package/dist/hooks/compaction/todoResolved.js +137 -0
- package/dist/hooks/compaction/todoResolved.js.map +1 -0
- package/dist/hooks/compaction/types.js +6 -0
- package/dist/hooks/compaction/types.js.map +1 -0
- package/dist/hooks/compaction.js +20 -20
- package/dist/hooks/compaction.js.map +1 -1
- package/dist/hooks/cursorPreToolUse.js +1 -1
- package/dist/hooks/cursorPreToolUse.js.map +1 -1
- package/dist/hooks/cursorSessionStart.js +10 -2
- package/dist/hooks/cursorSessionStart.js.map +1 -1
- package/dist/hooks/sessionStart.js +18 -11
- package/dist/hooks/sessionStart.js.map +1 -1
- package/dist/hooks/sessionStop.js +6 -12
- package/dist/hooks/sessionStop.js.map +1 -1
- package/dist/hooks/todoLayout.js +177 -0
- package/dist/hooks/todoLayout.js.map +1 -0
- package/dist/hooks/validateArtifact/agentFacing.js +10 -0
- package/dist/hooks/validateArtifact/agentFacing.js.map +1 -0
- package/dist/hooks/validateArtifact/index.js +151 -0
- package/dist/hooks/validateArtifact/index.js.map +1 -0
- package/dist/hooks/validateArtifact/markdown.js +146 -0
- package/dist/hooks/validateArtifact/markdown.js.map +1 -0
- package/dist/hooks/validateArtifact/runtime.js +86 -0
- package/dist/hooks/validateArtifact/runtime.js.map +1 -0
- package/dist/hooks/validateArtifact/schema.js +459 -0
- package/dist/hooks/validateArtifact/schema.js.map +1 -0
- package/dist/hooks/validateArtifact/traversal.js +106 -0
- package/dist/hooks/validateArtifact/traversal.js.map +1 -0
- package/dist/hooks/validateArtifact/violations.js +105 -0
- package/dist/hooks/validateArtifact/violations.js.map +1 -0
- package/dist/hooks/validateArtifact.js +29 -40
- package/dist/hooks/validateArtifact.js.map +1 -1
- package/dist/migrate/v2HandoffManifest.js +447 -0
- package/dist/migrate/v2HandoffManifest.js.map +1 -0
- package/dist/registries/artifactProtocolIds.js +77 -0
- package/dist/registries/artifactProtocolIds.js.map +1 -0
- package/dist/registries/artifactRegistry.js +23 -9
- package/dist/registries/artifactRegistry.js.map +1 -1
- package/dist/registries/capabilityContract.js +144 -1
- package/dist/registries/capabilityContract.js.map +1 -1
- package/dist/registries/evaluatorHandoffContract.js +2 -2
- package/dist/registries/evaluatorHandoffContract.js.map +1 -1
- package/dist/registries/packageRegistry.js +4 -3
- package/dist/registries/packageRegistry.js.map +1 -1
- package/dist/registries/runtimeAdapterRegistry.js +5 -4
- package/dist/registries/runtimeAdapterRegistry.js.map +1 -1
- package/dist/registries/triggerLoader.js +211 -0
- package/dist/registries/triggerLoader.js.map +1 -0
- package/dist/release/releaseMetadata.js +235 -0
- package/dist/release/releaseMetadata.js.map +1 -0
- package/dist/routing/index.js +2 -0
- package/dist/routing/index.js.map +1 -0
- package/dist/routing/routeEngine.js +189 -0
- package/dist/routing/routeEngine.js.map +1 -0
- package/dist/setup/codex/agents.js +96 -0
- package/dist/setup/codex/agents.js.map +1 -0
- package/dist/setup/codex/cli.js +161 -0
- package/dist/setup/codex/cli.js.map +1 -0
- package/dist/setup/codex/configToml.js +639 -0
- package/dist/setup/codex/configToml.js.map +1 -0
- package/dist/setup/codex/constants.js +29 -0
- package/dist/setup/codex/constants.js.map +1 -0
- package/dist/setup/codex/installRoot.js +64 -0
- package/dist/setup/codex/installRoot.js.map +1 -0
- package/dist/setup/codex/state.js +270 -0
- package/dist/setup/codex/state.js.map +1 -0
- package/dist/setup/codex.js +11 -1196
- package/dist/setup/codex.js.map +1 -1
- package/dist/setup/cursor.js +6 -4
- package/dist/setup/cursor.js.map +1 -1
- package/dist/setup/cursorSurfaces.js +67 -0
- package/dist/setup/cursorSurfaces.js.map +1 -0
- package/dist/setup/doctor/core.js +300 -0
- package/dist/setup/doctor/core.js.map +1 -0
- package/dist/setup/doctor/diagnostics.js +240 -0
- package/dist/setup/doctor/diagnostics.js.map +1 -0
- package/dist/setup/doctor/opencode.js +313 -0
- package/dist/setup/doctor/opencode.js.map +1 -0
- package/dist/setup/doctor/report.js +425 -0
- package/dist/setup/doctor/report.js.map +1 -0
- package/dist/setup/doctor.js +9 -1296
- package/dist/setup/doctor.js.map +1 -1
- package/dist/setup/opencode.js +13 -0
- package/dist/setup/opencode.js.map +1 -0
- package/dist/setup/smokeChecks.js +11 -11
- package/dist/setup/smokeChecks.js.map +1 -1
- package/dist/state/installRoot.js +49 -18
- package/dist/state/installRoot.js.map +1 -1
- package/dist/state/progressCommit.js +289 -0
- package/dist/state/progressCommit.js.map +1 -0
- package/dist/state/startupAnalysis/benchmark.js +371 -0
- package/dist/state/startupAnalysis/benchmark.js.map +1 -0
- package/dist/state/startupAnalysis/contract.js +126 -0
- package/dist/state/startupAnalysis/contract.js.map +1 -0
- package/dist/state/startupAnalysis/helpers.js +287 -0
- package/dist/state/startupAnalysis/helpers.js.map +1 -0
- package/dist/state/startupAnalysis/index.js +7 -0
- package/dist/state/startupAnalysis/index.js.map +1 -0
- package/dist/state/startupAnalysis/metrics.js +341 -0
- package/dist/state/startupAnalysis/metrics.js.map +1 -0
- package/dist/state/startupAnalysis/records.js +199 -0
- package/dist/state/startupAnalysis/records.js.map +1 -0
- package/dist/state/startupAnalysis/report.js +112 -0
- package/dist/state/startupAnalysis/report.js.map +1 -0
- package/dist/state/startupAnalysis/threshold.js +500 -0
- package/dist/state/startupAnalysis/threshold.js.map +1 -0
- package/dist/state/startupAnalysis.js +2 -1952
- package/dist/state/startupAnalysis.js.map +1 -1
- package/dist/upgrade/appContentRefresh.js +342 -0
- package/dist/upgrade/appContentRefresh.js.map +1 -0
- package/dist/upgrade/appModel.js +8 -6
- package/dist/upgrade/appModel.js.map +1 -1
- package/dist/upgrade/bundleEvidence.js +34 -0
- package/dist/upgrade/bundleEvidence.js.map +1 -0
- package/dist/upgrade/channels.js +11 -4
- package/dist/upgrade/channels.js.map +1 -1
- package/dist/upgrade/cliProbe.js +22 -0
- package/dist/upgrade/cliProbe.js.map +1 -0
- package/dist/upgrade/coexistenceProbe.js +107 -0
- package/dist/upgrade/coexistenceProbe.js.map +1 -0
- package/dist/upgrade/compatibility.js +13 -4
- package/dist/upgrade/compatibility.js.map +1 -1
- package/dist/upgrade/doctor.js +165 -183
- package/dist/upgrade/doctor.js.map +1 -1
- package/dist/upgrade/doctorClassifier.js +177 -0
- package/dist/upgrade/doctorClassifier.js.map +1 -0
- package/dist/upgrade/installedHooksRetirement.js +190 -0
- package/dist/upgrade/installedHooksRetirement.js.map +1 -0
- package/dist/upgrade/legacyAgentCleanup.js +116 -0
- package/dist/upgrade/legacyAgentCleanup.js.map +1 -0
- package/dist/upgrade/migrateArtifactsV2ToV3.js +57 -109
- package/dist/upgrade/migrateArtifactsV2ToV3.js.map +1 -1
- package/dist/upgrade/nextMajorDoctor.js +42 -7
- package/dist/upgrade/nextMajorDoctor.js.map +1 -1
- package/dist/upgrade/npxPlatformStatus.js +23 -0
- package/dist/upgrade/npxPlatformStatus.js.map +1 -0
- package/dist/upgrade/projectIntegration.js +69 -73
- package/dist/upgrade/projectIntegration.js.map +1 -1
- package/dist/upgrade/projectIntegrationDecision.js +93 -0
- package/dist/upgrade/projectIntegrationDecision.js.map +1 -0
- package/dist/upgrade/runtimeMigration.js +169 -68
- package/dist/upgrade/runtimeMigration.js.map +1 -1
- package/dist/upgrade/v3CapabilitySurface.js +15 -0
- package/dist/upgrade/v3CapabilitySurface.js.map +1 -0
- package/dist/upgrade/versionResolution.js +8 -0
- package/dist/upgrade/versionResolution.js.map +1 -1
- package/dist/validate/appHomeContract.js +4 -4
- package/dist/validate/appHomeContract.js.map +1 -1
- package/dist/validate/capability.js +124 -11
- package/dist/validate/capability.js.map +1 -1
- package/dist/validate/crossCapability.js +1 -1
- package/dist/validate/crossCapability.js.map +1 -1
- package/dist/validate/lifecycleAdapters/legacyPythonParity.js +93 -0
- package/dist/validate/lifecycleAdapters/legacyPythonParity.js.map +1 -0
- package/dist/validate/lifecycleAdapters/nodeFormChecks.js +488 -0
- package/dist/validate/lifecycleAdapters/nodeFormChecks.js.map +1 -0
- package/dist/validate/lifecycleAdapters/shared.js +198 -0
- package/dist/validate/lifecycleAdapters/shared.js.map +1 -0
- package/dist/validate/lifecycleAdapters.js +13 -723
- package/dist/validate/lifecycleAdapters.js.map +1 -1
- package/dist/validate/selfAudit.js +62 -20
- package/dist/validate/selfAudit.js.map +1 -1
- package/dist/validate/vocabularyAuthority.js +303 -0
- package/dist/validate/vocabularyAuthority.js.map +1 -0
- package/package.json +27 -24
- package/bundle/references/v1-section-mapping.md +0 -47
- package/bundle/skills/agentera/agents/dokumentera.toml +0 -6
- package/bundle/skills/agentera/agents/hej.toml +0 -6
- package/bundle/skills/agentera/agents/inspektera.toml +0 -6
- package/bundle/skills/agentera/agents/inspirera.toml +0 -6
- package/bundle/skills/agentera/agents/orkestrera.toml +0 -6
- package/bundle/skills/agentera/agents/profilera.toml +0 -6
- package/bundle/skills/agentera/agents/realisera.toml +0 -6
- package/bundle/skills/agentera/agents/visionera.toml +0 -6
- package/bundle/skills/agentera/agents/visualisera.toml +0 -6
- package/bundle/skills/hej/.claude-plugin/plugin.json +0 -6
- package/bundle/skills/hej/SKILL.md +0 -69
- package/bundle/skills/hej/agents/hej.toml +0 -11
- package/bundle/skills/hej/agents/openai.yaml +0 -8
- /package/bundle/skills/agentera/capabilities/{inspektera → audit}/schemas/exit.yaml +0 -0
- /package/bundle/skills/agentera/capabilities/{realisera → build}/schemas/exit.yaml +0 -0
- /package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/exit.yaml +0 -0
- /package/bundle/skills/agentera/capabilities/{resonera → discuss}/schemas/exit.yaml +0 -0
- /package/bundle/skills/agentera/capabilities/{dokumentera → document}/schemas/exit.yaml +0 -0
- /package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/exit.yaml +0 -0
- /package/bundle/skills/agentera/capabilities/{orkestrera → orchestrate}/schemas/exit.yaml +0 -0
- /package/bundle/skills/agentera/capabilities/{inspirera → research}/schemas/exit.yaml +0 -0
- /package/bundle/skills/agentera/capabilities/{hej → status}/schemas/exit.yaml +0 -0
- /package/bundle/skills/agentera/capabilities/{visionera → vision}/schemas/exit.yaml +0 -0
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import { resolvePath } from "../../core/paths.js";
|
|
3
|
+
import { isoFromMtime, record, signalType, textFromContent, } from "./core.js";
|
|
4
|
+
import { isPlainObject, rglob, isFilePath } from "./core.js";
|
|
5
|
+
import { resolveSqliteCaps, } from "./sqliteCaps.js";
|
|
6
|
+
import { PermissionDeniedError, openSqlite, sqliteTimestamp, tableColumns, firstColumn, qualified, } from "./sqliteSessions.js";
|
|
7
|
+
function copilotDbCandidates(storePath) {
|
|
8
|
+
if (isFilePath(storePath))
|
|
9
|
+
return [storePath];
|
|
10
|
+
return rglob(storePath, "session-store.db");
|
|
11
|
+
}
|
|
12
|
+
function copilotRows(conn, caps) {
|
|
13
|
+
const tables = new Set(conn.prepare("SELECT name FROM sqlite_master WHERE type = 'table'").all().map((r) => String(r.name)));
|
|
14
|
+
for (const t of ["sessions", "turns"]) {
|
|
15
|
+
if (!tables.has(t)) {
|
|
16
|
+
const missing = ["sessions", "turns"].filter((x) => !tables.has(x)).sort().join(",");
|
|
17
|
+
throw new Error(`missing copilot tables: ${missing}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const sessionCols = tableColumns(conn, "sessions");
|
|
21
|
+
const turnCols = tableColumns(conn, "turns");
|
|
22
|
+
const sessionId = firstColumn(sessionCols, ["id", "session_id", "sessionID"]);
|
|
23
|
+
const turnId = firstColumn(turnCols, ["id", "turn_id", "turnID"]);
|
|
24
|
+
const turnSession = firstColumn(turnCols, ["session_id", "sessionID", "session", "sessionId"]);
|
|
25
|
+
if (!(sessionId && turnSession))
|
|
26
|
+
throw new Error("missing copilot join columns");
|
|
27
|
+
const roleCol = firstColumn(turnCols, ["role", "actor", "author"]);
|
|
28
|
+
const textCol = firstColumn(turnCols, ["content", "text", "message", "prompt", "response"]);
|
|
29
|
+
if (roleCol === null)
|
|
30
|
+
throw new Error("missing copilot turn role column");
|
|
31
|
+
if (textCol === null)
|
|
32
|
+
throw new Error("missing copilot turn text column");
|
|
33
|
+
const sessionTime = firstColumn(sessionCols, ["time", "timestamp", "created_at", "createdAt"]);
|
|
34
|
+
const turnTime = firstColumn(turnCols, ["time", "timestamp", "created_at", "createdAt"]);
|
|
35
|
+
const turnOrder = firstColumn(turnCols, ["turn_index", "turnIndex", "idx", "position", "sequence"]);
|
|
36
|
+
const projectCol = firstColumn(sessionCols, ["cwd", "project_path", "projectPath", "directory", "path"]);
|
|
37
|
+
const turnData = firstColumn(turnCols, ["data", "payload", "json"]);
|
|
38
|
+
const turnType = firstColumn(turnCols, ["type", "kind"]);
|
|
39
|
+
const toolNameCol = firstColumn(turnCols, ["tool_name", "toolName", "tool", "name", "command_name", "commandName"]);
|
|
40
|
+
const toolArgs = firstColumn(turnCols, [
|
|
41
|
+
"arguments", "args", "input", "tool_input", "toolInput", "command", "command_line", "commandLine",
|
|
42
|
+
]);
|
|
43
|
+
const orderExpr = turnOrder ? `t."${turnOrder}"` : `t."${turnTime || turnSession}"`;
|
|
44
|
+
const idExpr = turnId ? `t."${turnId}"` : "t.rowid";
|
|
45
|
+
const query = `
|
|
46
|
+
SELECT
|
|
47
|
+
${qualified("s", sessionId, "session_id")},
|
|
48
|
+
${qualified("s", projectCol, "project_path")},
|
|
49
|
+
${qualified("t", turnId, "turn_id")},
|
|
50
|
+
${qualified("t", roleCol, "role")},
|
|
51
|
+
${qualified("t", turnTime, "turn_time")},
|
|
52
|
+
${qualified("s", sessionTime, "session_time")},
|
|
53
|
+
${qualified("t", textCol, "turn_text")},
|
|
54
|
+
${qualified("t", turnData, "turn_data")},
|
|
55
|
+
${qualified("t", turnType, "turn_type")},
|
|
56
|
+
${qualified("t", toolNameCol, "tool_name")},
|
|
57
|
+
${qualified("t", toolArgs, "tool_args")}
|
|
58
|
+
FROM turns t
|
|
59
|
+
JOIN sessions s ON t."${turnSession}" = s."${sessionId}"
|
|
60
|
+
ORDER BY COALESCE(${orderExpr}, t."${turnSession}"),
|
|
61
|
+
CASE LOWER(t."${roleCol}") WHEN 'user' THEN 0 WHEN 'assistant' THEN 1 ELSE 2 END,
|
|
62
|
+
${idExpr}
|
|
63
|
+
LIMIT ?
|
|
64
|
+
`;
|
|
65
|
+
return conn.prepare(query).all(caps.maxRows);
|
|
66
|
+
}
|
|
67
|
+
export function probeCopilotTruncation(conn, caps, fallback) {
|
|
68
|
+
const tables = new Set(conn.prepare("SELECT name FROM sqlite_master WHERE type = 'table'").all().map((r) => String(r.name)));
|
|
69
|
+
if (!tables.has("sessions") || !tables.has("turns"))
|
|
70
|
+
return null;
|
|
71
|
+
const sessionCols = tableColumns(conn, "sessions");
|
|
72
|
+
const turnCols = tableColumns(conn, "turns");
|
|
73
|
+
const sessionId = firstColumn(sessionCols, ["id", "session_id", "sessionID"]);
|
|
74
|
+
const turnSession = firstColumn(turnCols, ["session_id", "sessionID", "session", "sessionId"]);
|
|
75
|
+
const roleCol = firstColumn(turnCols, ["role", "actor", "author"]);
|
|
76
|
+
if (!(sessionId && turnSession && roleCol))
|
|
77
|
+
return null;
|
|
78
|
+
const turnId = firstColumn(turnCols, ["id", "turn_id", "turnID"]);
|
|
79
|
+
const sessionTime = firstColumn(sessionCols, ["time", "timestamp", "created_at", "createdAt"]);
|
|
80
|
+
const turnTime = firstColumn(turnCols, ["time", "timestamp", "created_at", "createdAt"]);
|
|
81
|
+
const turnOrder = firstColumn(turnCols, ["turn_index", "turnIndex", "idx", "position", "sequence"]);
|
|
82
|
+
const orderExpr = turnOrder ? `t."${turnOrder}"` : `t."${turnTime || turnSession}"`;
|
|
83
|
+
const idExpr = turnId ? `t."${turnId}"` : "t.rowid";
|
|
84
|
+
const turnCount = Number(conn.prepare("SELECT COUNT(*) AS c FROM turns t JOIN sessions s ON t.\"" + turnSession + "\" = s.\"" + sessionId + "\"").get()?.c ?? 0);
|
|
85
|
+
if (turnCount <= caps.maxRows)
|
|
86
|
+
return null;
|
|
87
|
+
const timeExpr = `COALESCE(t."${turnTime || turnSession}", s."${sessionTime || sessionId}")`;
|
|
88
|
+
const query = `
|
|
89
|
+
SELECT MIN(turn_ts) AS truncated_at
|
|
90
|
+
FROM (
|
|
91
|
+
SELECT ${timeExpr} AS turn_ts
|
|
92
|
+
FROM turns t
|
|
93
|
+
JOIN sessions s ON t."${turnSession}" = s."${sessionId}"
|
|
94
|
+
ORDER BY COALESCE(${orderExpr}, t."${turnSession}"),
|
|
95
|
+
CASE LOWER(t."${roleCol}") WHEN 'user' THEN 0 WHEN 'assistant' THEN 1 ELSE 2 END,
|
|
96
|
+
${idExpr}
|
|
97
|
+
LIMIT -1 OFFSET ?
|
|
98
|
+
)
|
|
99
|
+
`;
|
|
100
|
+
const row = conn.prepare(query).get(caps.maxRows);
|
|
101
|
+
const truncatedAt = sqliteTimestamp(row?.truncated_at, fallback);
|
|
102
|
+
return { truncatedAt, cap: "rows", limit: caps.maxRows };
|
|
103
|
+
}
|
|
104
|
+
function copilotArgumentDict(value) {
|
|
105
|
+
if (isPlainObject(value)) {
|
|
106
|
+
const stateInput = value.input;
|
|
107
|
+
if (isPlainObject(stateInput) && !("command" in value))
|
|
108
|
+
return stateInput;
|
|
109
|
+
return value;
|
|
110
|
+
}
|
|
111
|
+
if (typeof value === "string" && value) {
|
|
112
|
+
try {
|
|
113
|
+
const parsed = JSON.parse(value);
|
|
114
|
+
return isPlainObject(parsed) ? parsed : { value: parsed };
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
return { command: value };
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return {};
|
|
121
|
+
}
|
|
122
|
+
function copilotJsonTools(value, errors, malformedLabel) {
|
|
123
|
+
if (typeof value === "string" && value) {
|
|
124
|
+
const raw = value;
|
|
125
|
+
try {
|
|
126
|
+
value = JSON.parse(value);
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
if (errors && malformedLabel && /^\s*[{[]/.test(raw))
|
|
130
|
+
errors.push(malformedLabel);
|
|
131
|
+
return [];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (Array.isArray(value)) {
|
|
135
|
+
const tools = [];
|
|
136
|
+
for (const item of value)
|
|
137
|
+
tools.push(...copilotJsonTools(item, errors, malformedLabel));
|
|
138
|
+
return tools;
|
|
139
|
+
}
|
|
140
|
+
if (!isPlainObject(value))
|
|
141
|
+
return [];
|
|
142
|
+
const toolName = value.tool_name || value.toolName || value.tool || value.name;
|
|
143
|
+
const valueType = String(value.type || value.kind || "").toLowerCase();
|
|
144
|
+
if (typeof toolName === "string" &&
|
|
145
|
+
toolName &&
|
|
146
|
+
["", "tool", "tool_call", "function_call", "tool_use", "command"].includes(valueType)) {
|
|
147
|
+
return [
|
|
148
|
+
{
|
|
149
|
+
tool_name: toolName,
|
|
150
|
+
arguments: copilotArgumentDict(value.arguments || value.args || value.input || value.state || {}),
|
|
151
|
+
},
|
|
152
|
+
];
|
|
153
|
+
}
|
|
154
|
+
const tools = [];
|
|
155
|
+
for (const key of ["tool_calls", "toolCalls", "tools", "content", "parts", "items"]) {
|
|
156
|
+
const nested = value[key];
|
|
157
|
+
if (isPlainObject(nested) || Array.isArray(nested))
|
|
158
|
+
tools.push(...copilotJsonTools(nested, errors, malformedLabel));
|
|
159
|
+
}
|
|
160
|
+
return tools;
|
|
161
|
+
}
|
|
162
|
+
function copilotRowTools(row, errors) {
|
|
163
|
+
const tools = copilotJsonTools(row.turn_data, errors, "copilot malformed json tool payload");
|
|
164
|
+
tools.push(...copilotJsonTools(row.turn_text));
|
|
165
|
+
const toolName = row.tool_name;
|
|
166
|
+
if (typeof toolName === "string" && toolName) {
|
|
167
|
+
tools.push({ tool_name: toolName, arguments: copilotArgumentDict(row.tool_args) });
|
|
168
|
+
}
|
|
169
|
+
else if (String(row.turn_type || "").toLowerCase() === "command") {
|
|
170
|
+
const command = row.tool_args || row.turn_text;
|
|
171
|
+
if (typeof command === "string" && command)
|
|
172
|
+
tools.push({ tool_name: "bash", arguments: { command } });
|
|
173
|
+
}
|
|
174
|
+
return tools.filter((t) => typeof t.tool_name === "string" && t.tool_name);
|
|
175
|
+
}
|
|
176
|
+
export function extractCopilotSessions(storePath, errors, ctx) {
|
|
177
|
+
if (storePath === null || !fs.existsSync(storePath))
|
|
178
|
+
return [];
|
|
179
|
+
const caps = ctx?.sqliteCaps ?? resolveSqliteCaps();
|
|
180
|
+
const records = [];
|
|
181
|
+
for (const dbPath of copilotDbCandidates(storePath).slice(0, 1)) {
|
|
182
|
+
const fallbackTimestamp = isoFromMtime(dbPath);
|
|
183
|
+
let rows;
|
|
184
|
+
let conn = null;
|
|
185
|
+
try {
|
|
186
|
+
conn = openSqlite(dbPath);
|
|
187
|
+
const truncation = probeCopilotTruncation(conn, caps, fallbackTimestamp);
|
|
188
|
+
if (truncation && ctx)
|
|
189
|
+
ctx.truncation = truncation;
|
|
190
|
+
rows = copilotRows(conn, caps);
|
|
191
|
+
}
|
|
192
|
+
catch (exc) {
|
|
193
|
+
const msg = exc.message || "";
|
|
194
|
+
if (/lock|busy/i.test(msg))
|
|
195
|
+
throw new PermissionDeniedError(msg);
|
|
196
|
+
errors.push(`${dbPath}: copilot sqlite read failed: ${exc.name || "Error"}`);
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
finally {
|
|
200
|
+
try {
|
|
201
|
+
conn?.close();
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
/* ignore */
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
let previousAssistant = "";
|
|
208
|
+
let index = 0;
|
|
209
|
+
for (const row of rows) {
|
|
210
|
+
index += 1;
|
|
211
|
+
const role = String(row.role).toLowerCase();
|
|
212
|
+
if (role !== "user" && role !== "assistant")
|
|
213
|
+
continue;
|
|
214
|
+
const content = textFromContent(row.turn_text);
|
|
215
|
+
const toolItems = copilotRowTools(row, errors);
|
|
216
|
+
if (!content && toolItems.length === 0)
|
|
217
|
+
continue;
|
|
218
|
+
const projectPath = row.project_path ? String(row.project_path) : null;
|
|
219
|
+
const timestamp = sqliteTimestamp(row.turn_time || row.session_time, fallbackTimestamp);
|
|
220
|
+
if (content) {
|
|
221
|
+
const data = { actor: role, content };
|
|
222
|
+
if (role === "user") {
|
|
223
|
+
if (previousAssistant)
|
|
224
|
+
data.preceding_context = previousAssistant.slice(-2000);
|
|
225
|
+
const sig = signalType(content);
|
|
226
|
+
if (sig)
|
|
227
|
+
data.signal_type = sig;
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
previousAssistant = content;
|
|
231
|
+
}
|
|
232
|
+
records.push(record({
|
|
233
|
+
sourceKind: "conversation_turn",
|
|
234
|
+
timestamp,
|
|
235
|
+
projectPath,
|
|
236
|
+
runtime: "github-copilot",
|
|
237
|
+
sourceParts: [resolvePath(dbPath), index, role, content.slice(0, 80)],
|
|
238
|
+
sessionId: String(row.session_id),
|
|
239
|
+
data,
|
|
240
|
+
}));
|
|
241
|
+
}
|
|
242
|
+
let toolIndex = 0;
|
|
243
|
+
for (const toolItem of toolItems) {
|
|
244
|
+
toolIndex += 1;
|
|
245
|
+
records.push(record({
|
|
246
|
+
sourceKind: "tool_call",
|
|
247
|
+
timestamp,
|
|
248
|
+
projectPath,
|
|
249
|
+
runtime: "github-copilot",
|
|
250
|
+
sourceParts: [resolvePath(dbPath), index, toolIndex, "tool", toolItem.tool_name, row.turn_id],
|
|
251
|
+
sessionId: String(row.session_id),
|
|
252
|
+
data: { tool_name: String(toolItem.tool_name), arguments: toolItem.arguments || {} },
|
|
253
|
+
}));
|
|
254
|
+
}
|
|
255
|
+
if (role === "user") {
|
|
256
|
+
const sig = signalType(content);
|
|
257
|
+
if (sig) {
|
|
258
|
+
records.push(record({
|
|
259
|
+
sourceKind: "history_prompt",
|
|
260
|
+
timestamp,
|
|
261
|
+
projectPath,
|
|
262
|
+
runtime: "github-copilot",
|
|
263
|
+
sourceParts: [resolvePath(dbPath), index, "history", content.slice(0, 120)],
|
|
264
|
+
sessionId: String(row.session_id),
|
|
265
|
+
data: { prompt: content, signal_type: sig },
|
|
266
|
+
}));
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return records;
|
|
272
|
+
}
|
|
273
|
+
//# sourceMappingURL=copilotSessions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilotSessions.js","sourceRoot":"","sources":["../../../src/analytics/extractCorpus/copilotSessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EACL,YAAY,EACZ,MAAM,EACN,UAAU,EACV,eAAe,GAChB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAGL,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,qBAAqB,EACrB,UAAU,EACV,eAAe,EACf,YAAY,EACZ,WAAW,EACX,SAAS,GAEV,MAAM,qBAAqB,CAAC;AAE7B,SAAS,mBAAmB,CAAC,SAAiB;IAC5C,IAAI,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC9C,OAAO,KAAK,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,WAAW,CAAC,IAAc,EAAE,IAAgB;IACnD,MAAM,MAAM,GAAG,IAAI,GAAG,CACpB,IAAI,CAAC,OAAO,CAAC,qDAAqD,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,C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AAE,gBAAgB;oBACzB,WAAW,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC;oBAC7F,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC;oBACjC,IAAI,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,IAAI,EAAE,EAAE;iBACrF,CAAC,CACH,CAAC;YACJ,CAAC;YACD,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;gBACpB,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;gBAChC,IAAI,GAAG,EAAE,CAAC;oBACR,OAAO,CAAC,IAAI,CACV,MAAM,CAAC;wBACL,UAAU,EAAE,gBAAgB;wBAC5B,SAAS;wBACT,WAAW;wBACX,OAAO,EAAE,gBAAgB;wBACzB,WAAW,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;wBAC3E,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC;wBACjC,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE;qBAC5C,CAAC,CACH,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { resolveProfileDirOverride, resolveXdgDataHome } from "../../core/envPaths.js";
|
|
5
|
+
import { expanduser } from "../../core/paths.js";
|
|
6
|
+
import crypto from "node:crypto";
|
|
7
|
+
import { resolvePath } from "../../core/paths.js";
|
|
8
|
+
export const ADAPTER_VERSION = "agentera-v2-corpus-1";
|
|
9
|
+
export const FAMILIES = [
|
|
10
|
+
"instruction_document",
|
|
11
|
+
"history_prompt",
|
|
12
|
+
"conversation_turn",
|
|
13
|
+
"tool_call",
|
|
14
|
+
"project_config_signal",
|
|
15
|
+
];
|
|
16
|
+
export const RUNTIME_STORE_GLOBS = {
|
|
17
|
+
codex: "*.jsonl",
|
|
18
|
+
"claude-code": "*.jsonl",
|
|
19
|
+
cursor: "*.jsonl",
|
|
20
|
+
"cursor-agent": "store.db",
|
|
21
|
+
opencode: "opencode.db",
|
|
22
|
+
"github-copilot": "session-store.db",
|
|
23
|
+
};
|
|
24
|
+
export const MAX_TOOL_ARG_TEXT = 500;
|
|
25
|
+
export const MAX_SQLITE_ROWS = 100_000;
|
|
26
|
+
export const MAX_SQLITE_SESSIONS = 60;
|
|
27
|
+
export const COPILOT_SPARSE_REMEDIATION = "/chronicle reindex";
|
|
28
|
+
const DECISION_RE = /\b(decide|decision|prefer|preference|instead|avoid|don't|do not|should|trade[- ]?off|scope|plan|commit|review|fix|why|question|blocked|stuck|approve|reject|change|keep|remove)\b/i;
|
|
29
|
+
const CORRECTION_RE = /\b(no|not quite|actually|rather|instead|wrong|correction|that's not|that is not|don't|do not)\b/i;
|
|
30
|
+
const QUESTION_RE = /\?|^\s*(why|what|how|should|can|could|would)\b/i;
|
|
31
|
+
export function isoNow() {
|
|
32
|
+
// Python datetime.now(utc).isoformat() -> microseconds + "+00:00" -> "Z".
|
|
33
|
+
// JS gives milliseconds; corpus extracted_at is a wall-clock stamp, not a
|
|
34
|
+
// parity-critical record value.
|
|
35
|
+
return new Date().toISOString().replace(/Z$/, "Z");
|
|
36
|
+
}
|
|
37
|
+
export function isoFromMtime(p) {
|
|
38
|
+
const ms = fs.statSync(p).mtimeMs;
|
|
39
|
+
return new Date(ms).toISOString().replace(/Z$/, "Z");
|
|
40
|
+
}
|
|
41
|
+
export function stableId(...parts) {
|
|
42
|
+
const raw = parts.map((p) => pyStr(p)).join("\0");
|
|
43
|
+
return crypto.createHash("sha256").update(raw, "utf-8").digest("hex").slice(0, 24);
|
|
44
|
+
}
|
|
45
|
+
/** Python str() for the scalar/None values stable_id receives. */
|
|
46
|
+
function pyStr(value) {
|
|
47
|
+
if (value === null || value === undefined)
|
|
48
|
+
return "None";
|
|
49
|
+
if (value === true)
|
|
50
|
+
return "True";
|
|
51
|
+
if (value === false)
|
|
52
|
+
return "False";
|
|
53
|
+
return String(value);
|
|
54
|
+
}
|
|
55
|
+
export function projectIdFromPath(p) {
|
|
56
|
+
if (p === null)
|
|
57
|
+
return "global";
|
|
58
|
+
const name = path.basename(p) || p;
|
|
59
|
+
const slug = name
|
|
60
|
+
.replace(/[^A-Za-z0-9._-]+/g, "-")
|
|
61
|
+
.replace(/^-+/, "")
|
|
62
|
+
.replace(/-+$/, "")
|
|
63
|
+
.toLowerCase();
|
|
64
|
+
return slug || "global";
|
|
65
|
+
}
|
|
66
|
+
export function defaultAgenteraHome(env = process.env, platform = process.platform) {
|
|
67
|
+
const override = env.AGENTERA_HOME;
|
|
68
|
+
if (override)
|
|
69
|
+
return expanduser(override);
|
|
70
|
+
if (platform === "darwin")
|
|
71
|
+
return path.join(os.homedir(), "Library", "Application Support", "agentera");
|
|
72
|
+
if (platform === "win32") {
|
|
73
|
+
const appdata = env.APPDATA || path.join(os.homedir(), "AppData", "Roaming");
|
|
74
|
+
return path.join(expanduser(appdata), "agentera");
|
|
75
|
+
}
|
|
76
|
+
return path.join(resolveXdgDataHome(env), "agentera");
|
|
77
|
+
}
|
|
78
|
+
export function defaultProfileDir(env = process.env, platform = process.platform) {
|
|
79
|
+
const override = resolveProfileDirOverride(env);
|
|
80
|
+
if (override)
|
|
81
|
+
return expanduser(override);
|
|
82
|
+
return defaultAgenteraHome(env, platform);
|
|
83
|
+
}
|
|
84
|
+
export function defaultOutputPath(env = process.env, platform = process.platform) {
|
|
85
|
+
return path.join(defaultProfileDir(env, platform), "intermediate", "corpus.json");
|
|
86
|
+
}
|
|
87
|
+
export function runtimeStatus(runtime, opts) {
|
|
88
|
+
const item = { runtime, status: opts.status, reason: opts.reason };
|
|
89
|
+
if (opts.storePath !== null && opts.storePath !== undefined)
|
|
90
|
+
item.store_path = opts.storePath;
|
|
91
|
+
if (opts.fileCount !== null && opts.fileCount !== undefined)
|
|
92
|
+
item.file_count = opts.fileCount;
|
|
93
|
+
if (opts.recordCount !== null && opts.recordCount !== undefined)
|
|
94
|
+
item.record_count = opts.recordCount;
|
|
95
|
+
if (opts.errorCount !== null && opts.errorCount !== undefined)
|
|
96
|
+
item.error_count = opts.errorCount;
|
|
97
|
+
if (opts.remediationLabels && opts.remediationLabels.length > 0)
|
|
98
|
+
item.remediation_labels = opts.remediationLabels;
|
|
99
|
+
if (opts.truncatedAt)
|
|
100
|
+
item.truncated_at = opts.truncatedAt;
|
|
101
|
+
if (opts.truncationCap)
|
|
102
|
+
item.truncation_cap = opts.truncationCap;
|
|
103
|
+
if (opts.truncationLimit !== null && opts.truncationLimit !== undefined)
|
|
104
|
+
item.truncation_limit = opts.truncationLimit;
|
|
105
|
+
return item;
|
|
106
|
+
}
|
|
107
|
+
function isDir(p) {
|
|
108
|
+
try {
|
|
109
|
+
return fs.statSync(p).isDirectory();
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function isFilePath(p) {
|
|
116
|
+
try {
|
|
117
|
+
return fs.statSync(p).isFile();
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/** Recursive glob for a simple pattern ("*.jsonl" or an exact filename). */
|
|
124
|
+
function rglob(root, pattern) {
|
|
125
|
+
const out = [];
|
|
126
|
+
const matchesExt = pattern.startsWith("*.") ? pattern.slice(1) : null; // ".jsonl"
|
|
127
|
+
const exact = matchesExt ? null : pattern;
|
|
128
|
+
const walk = (dir) => {
|
|
129
|
+
let entries;
|
|
130
|
+
try {
|
|
131
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
for (const e of entries) {
|
|
137
|
+
const full = path.join(dir, e.name);
|
|
138
|
+
if (e.isDirectory())
|
|
139
|
+
walk(full);
|
|
140
|
+
else if (e.isFile()) {
|
|
141
|
+
if (matchesExt ? e.name.endsWith(matchesExt) : e.name === exact)
|
|
142
|
+
out.push(full);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
walk(root);
|
|
147
|
+
return out.sort();
|
|
148
|
+
}
|
|
149
|
+
export function discoverRuntimeStore(runtime, storePath) {
|
|
150
|
+
if (storePath === null) {
|
|
151
|
+
return runtimeStatus(runtime, { status: "skipped", reason: "disabled", storePath: null });
|
|
152
|
+
}
|
|
153
|
+
if (!fs.existsSync(storePath)) {
|
|
154
|
+
return runtimeStatus(runtime, {
|
|
155
|
+
status: "missing",
|
|
156
|
+
reason: "store_absent",
|
|
157
|
+
storePath,
|
|
158
|
+
remediationLabels: runtime === "github-copilot" ? [COPILOT_SPARSE_REMEDIATION] : null,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
if ((runtime === "opencode" || runtime === "github-copilot") && isFilePath(storePath)) {
|
|
162
|
+
return runtimeStatus(runtime, {
|
|
163
|
+
status: "available",
|
|
164
|
+
reason: "candidate_files_found",
|
|
165
|
+
storePath,
|
|
166
|
+
fileCount: 1,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
if (!isDir(storePath)) {
|
|
170
|
+
return runtimeStatus(runtime, { status: "degraded", reason: "store_not_directory", storePath });
|
|
171
|
+
}
|
|
172
|
+
let candidates;
|
|
173
|
+
try {
|
|
174
|
+
candidates = rglob(storePath, RUNTIME_STORE_GLOBS[runtime]);
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
return runtimeStatus(runtime, { status: "degraded", reason: "store_unreadable", storePath });
|
|
178
|
+
}
|
|
179
|
+
if (candidates.length === 0) {
|
|
180
|
+
return runtimeStatus(runtime, {
|
|
181
|
+
status: "sparse",
|
|
182
|
+
reason: "no_candidate_files",
|
|
183
|
+
storePath,
|
|
184
|
+
fileCount: 0,
|
|
185
|
+
remediationLabels: runtime === "github-copilot" ? [COPILOT_SPARSE_REMEDIATION] : null,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
return runtimeStatus(runtime, {
|
|
189
|
+
status: "available",
|
|
190
|
+
reason: "candidate_files_found",
|
|
191
|
+
storePath,
|
|
192
|
+
fileCount: candidates.length,
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
// ── record builders + content helpers ──────────────────────────────
|
|
196
|
+
export function splitLines(text) {
|
|
197
|
+
const parts = text.split(/\r\n|\r|\n/);
|
|
198
|
+
if (parts.length > 0 && parts[parts.length - 1] === "")
|
|
199
|
+
parts.pop();
|
|
200
|
+
return parts;
|
|
201
|
+
}
|
|
202
|
+
export function record(opts) {
|
|
203
|
+
const item = {
|
|
204
|
+
source_id: stableId(opts.sourceKind, ...opts.sourceParts),
|
|
205
|
+
timestamp: opts.timestamp,
|
|
206
|
+
project_id: projectIdFromPath(opts.projectPath),
|
|
207
|
+
source_kind: opts.sourceKind,
|
|
208
|
+
runtime: opts.runtime,
|
|
209
|
+
adapter_version: ADAPTER_VERSION,
|
|
210
|
+
data: opts.data,
|
|
211
|
+
};
|
|
212
|
+
if (opts.projectPath !== null && opts.projectPath !== undefined)
|
|
213
|
+
item.project_path = opts.projectPath;
|
|
214
|
+
if (opts.sessionId) {
|
|
215
|
+
item.session_id = opts.sessionId;
|
|
216
|
+
item.conversation_key = opts.sessionId;
|
|
217
|
+
}
|
|
218
|
+
return item;
|
|
219
|
+
}
|
|
220
|
+
function isPlainObject(v) {
|
|
221
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
222
|
+
}
|
|
223
|
+
export function payloadItem(event) {
|
|
224
|
+
const payload = event.payload;
|
|
225
|
+
if (isPlainObject(payload)) {
|
|
226
|
+
const nested = payload.item;
|
|
227
|
+
if (isPlainObject(nested))
|
|
228
|
+
return nested;
|
|
229
|
+
return payload;
|
|
230
|
+
}
|
|
231
|
+
return event;
|
|
232
|
+
}
|
|
233
|
+
export function eventKind(event) {
|
|
234
|
+
for (const key of ["type", "event", "name"]) {
|
|
235
|
+
const value = event[key];
|
|
236
|
+
if (typeof value === "string")
|
|
237
|
+
return value;
|
|
238
|
+
}
|
|
239
|
+
return "";
|
|
240
|
+
}
|
|
241
|
+
export function eventTimestamp(item, fallback) {
|
|
242
|
+
const payload = isPlainObject(item.payload) ? item.payload : {};
|
|
243
|
+
const nested = isPlainObject(payload.item) ? payload.item : {};
|
|
244
|
+
for (const source of [item, payload, nested]) {
|
|
245
|
+
for (const key of ["timestamp", "created_at", "createdAt", "time"]) {
|
|
246
|
+
const value = source[key];
|
|
247
|
+
if (typeof value === "string" && value)
|
|
248
|
+
return value;
|
|
249
|
+
if (typeof value === "number") {
|
|
250
|
+
return new Date(value * 1000).toISOString();
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return fallback;
|
|
255
|
+
}
|
|
256
|
+
export function textFromContent(value) {
|
|
257
|
+
if (value === null || value === undefined)
|
|
258
|
+
return "";
|
|
259
|
+
if (typeof value === "string")
|
|
260
|
+
return value;
|
|
261
|
+
if (Array.isArray(value)) {
|
|
262
|
+
const parts = value.map((it) => textFromContent(it));
|
|
263
|
+
return parts.filter((p) => p).join("\n");
|
|
264
|
+
}
|
|
265
|
+
if (isPlainObject(value)) {
|
|
266
|
+
for (const key of ["text", "input_text", "output_text", "message", "content"]) {
|
|
267
|
+
const text = textFromContent(value[key]);
|
|
268
|
+
if (text)
|
|
269
|
+
return text;
|
|
270
|
+
}
|
|
271
|
+
return "";
|
|
272
|
+
}
|
|
273
|
+
return pyStr(value);
|
|
274
|
+
}
|
|
275
|
+
export function claudeContentItems(event) {
|
|
276
|
+
const items = [];
|
|
277
|
+
const msg = isPlainObject(event.message) ? event.message : null;
|
|
278
|
+
for (const source of [event, msg]) {
|
|
279
|
+
if (!isPlainObject(source))
|
|
280
|
+
continue;
|
|
281
|
+
const content = source.content;
|
|
282
|
+
if (Array.isArray(content)) {
|
|
283
|
+
for (const it of content)
|
|
284
|
+
if (isPlainObject(it))
|
|
285
|
+
items.push(it);
|
|
286
|
+
}
|
|
287
|
+
else if (isPlainObject(content)) {
|
|
288
|
+
items.push(content);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
return items;
|
|
292
|
+
}
|
|
293
|
+
export function* iterJsonl(p, errors) {
|
|
294
|
+
let text;
|
|
295
|
+
try {
|
|
296
|
+
text = fs.readFileSync(p, "utf-8");
|
|
297
|
+
}
|
|
298
|
+
catch (exc) {
|
|
299
|
+
errors.push(`${p}: cannot read: ${exc.message}`);
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
const lines = text.split("\n");
|
|
303
|
+
for (let i = 0; i < lines.length; i++) {
|
|
304
|
+
const stripped = lines[i].trim();
|
|
305
|
+
if (!stripped)
|
|
306
|
+
continue;
|
|
307
|
+
let item;
|
|
308
|
+
try {
|
|
309
|
+
item = JSON.parse(stripped);
|
|
310
|
+
}
|
|
311
|
+
catch (exc) {
|
|
312
|
+
errors.push(`${p}:${i + 1}: invalid jsonl: ${exc.message}`);
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
if (isPlainObject(item))
|
|
316
|
+
yield item;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
export function signalType(text) {
|
|
320
|
+
if (!text || !DECISION_RE.test(text))
|
|
321
|
+
return null;
|
|
322
|
+
if (CORRECTION_RE.test(text))
|
|
323
|
+
return "correction";
|
|
324
|
+
if (QUESTION_RE.test(text))
|
|
325
|
+
return "question";
|
|
326
|
+
return "decision";
|
|
327
|
+
}
|
|
328
|
+
export function toolCallRecordFromItem(args) {
|
|
329
|
+
const { item, event } = args;
|
|
330
|
+
const kind = eventKind(event);
|
|
331
|
+
const itemType = item.type;
|
|
332
|
+
if (!["tool_call", "function_call"].includes(kind) &&
|
|
333
|
+
!["tool_call", "function_call", "tool_use"].includes(itemType)) {
|
|
334
|
+
return null;
|
|
335
|
+
}
|
|
336
|
+
const toolName = item.tool_name || item.name || item.tool;
|
|
337
|
+
if (typeof toolName !== "string" || !toolName)
|
|
338
|
+
return null;
|
|
339
|
+
let argumentsVal = item.arguments || item.input || item.args || {};
|
|
340
|
+
if (typeof argumentsVal === "string") {
|
|
341
|
+
try {
|
|
342
|
+
argumentsVal = JSON.parse(argumentsVal);
|
|
343
|
+
}
|
|
344
|
+
catch {
|
|
345
|
+
argumentsVal = { raw: argumentsVal };
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
if (!isPlainObject(argumentsVal))
|
|
349
|
+
argumentsVal = { value: argumentsVal };
|
|
350
|
+
return record({
|
|
351
|
+
sourceKind: "tool_call",
|
|
352
|
+
timestamp: eventTimestamp(event, args.fallbackTimestamp),
|
|
353
|
+
projectPath: args.projectPath,
|
|
354
|
+
runtime: args.runtime,
|
|
355
|
+
sourceParts: [resolvePath(args.sourcePath), args.index, "tool", toolName],
|
|
356
|
+
sessionId: args.sessionId,
|
|
357
|
+
data: { tool_name: toolName, arguments: argumentsVal }, // cast: parsed JSON IO boundary
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
export function toolCallRecord(args) {
|
|
361
|
+
return toolCallRecordFromItem({ ...args, item: payloadItem(args.event) });
|
|
362
|
+
}
|
|
363
|
+
export { isPlainObject, rglob, isDir, isFilePath };
|
|
364
|
+
//# sourceMappingURL=core.js.map
|