@aiwg/cli 2026.10.1 → 2026.10.4
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 +2 -2
- package/agentic/code/providers/capability-matrix.yaml +270 -0
- package/agentic/code/providers/model-capabilities.v1.json +3183 -24
- package/bin/aiwg.mjs +135 -47
- package/dist/src/a2a/codecs.js +9 -0
- package/dist/src/agents/grounding/knowledge-base.js +54 -6
- package/dist/src/artifacts/browser-export.js +6 -0
- package/dist/src/artifacts/checksum-manifest.js +1 -0
- package/dist/src/artifacts/citation-parser.js +173 -92
- package/dist/src/artifacts/citation-table-schema.js +59 -0
- package/dist/src/artifacts/cli.js +57 -18
- package/dist/src/artifacts/corpus-tools/snapshot.js +1 -1
- package/dist/src/artifacts/corpus-tools/vision-extract.js +107 -15
- package/dist/src/artifacts/corpus-views/ref-parser.js +3 -1
- package/dist/src/artifacts/corpus-views/renderers.js +3 -3
- package/dist/src/artifacts/discovery-eval.js +6 -4
- package/dist/src/artifacts/fortemi-core-query-adapter.js +36 -3
- package/dist/src/artifacts/fortemi-core-sync.js +166 -40
- package/dist/src/artifacts/framework-capabilities.js +171 -0
- package/dist/src/artifacts/framework-index-paths.js +73 -0
- package/dist/src/artifacts/framework-source-digest.js +75 -0
- package/dist/src/artifacts/index-builder.js +285 -131
- package/dist/src/artifacts/index-files.js +132 -18
- package/dist/src/artifacts/index-preparation.js +65 -0
- package/dist/src/artifacts/index-refresh.js +576 -0
- package/dist/src/artifacts/index-worker.mjs +9 -0
- package/dist/src/artifacts/prebuilt-build-lock.js +47 -4
- package/dist/src/artifacts/prebuilt-deployment.js +46 -0
- package/dist/src/artifacts/prebuilt-relations.js +80 -0
- package/dist/src/artifacts/query-engine.js +410 -88
- package/dist/src/artifacts/relations-builder.js +168 -0
- package/dist/src/artifacts/relations.js +148 -0
- package/dist/src/artifacts/repair.js +9 -4
- package/dist/src/artifacts/stats.js +5 -2
- package/dist/src/artifacts/types.js +30 -10
- package/dist/src/artifacts/watcher.js +1 -1
- package/dist/src/auth/credential-store.js +2 -1
- package/dist/src/catalog/cli.d.mts +5 -0
- package/dist/src/channel/manager.d.mts +20 -0
- package/dist/src/channel/manager.mjs +78 -12
- package/dist/src/cli/child-process-result.js +40 -0
- package/dist/src/cli/command-log.js +2 -3
- package/dist/src/cli/env.js +38 -16
- package/dist/src/cli/flag-parsing.js +236 -0
- package/dist/src/cli/handlers/artifacts.js +3 -0
- package/dist/src/cli/handlers/auth.js +3 -0
- package/dist/src/cli/handlers/decision.js +218 -5
- package/dist/src/cli/handlers/diagnose.js +13 -5
- package/dist/src/cli/handlers/effect.js +4 -2
- package/dist/src/cli/handlers/evidence.js +3 -0
- package/dist/src/cli/handlers/feedback.js +14 -5
- package/dist/src/cli/handlers/help.js +1 -0
- package/dist/src/cli/handlers/index.js +3 -1
- package/dist/src/cli/handlers/init.js +248 -30
- package/dist/src/cli/handlers/lint.js +5 -0
- package/dist/src/cli/handlers/mc.js +23 -0
- package/dist/src/cli/handlers/models.js +169 -10
- package/dist/src/cli/handlers/ralph-launcher.js +2 -0
- package/dist/src/cli/handlers/ralph.js +3 -0
- package/dist/src/cli/handlers/refresh.js +28 -0
- package/dist/src/cli/handlers/regenerate.js +14 -0
- package/dist/src/cli/handlers/resource-versions.js +3 -0
- package/dist/src/cli/handlers/rules.js +195 -0
- package/dist/src/cli/handlers/run.js +4 -0
- package/dist/src/cli/handlers/runtime-info.js +25 -11
- package/dist/src/cli/handlers/script-runner.js +19 -8
- package/dist/src/cli/handlers/session.js +406 -62
- package/dist/src/cli/handlers/sessions.js +243 -76
- package/dist/src/cli/handlers/setup-manifest.js +474 -79
- package/dist/src/cli/handlers/setup.js +180 -39
- package/dist/src/cli/handlers/steward.js +11 -0
- package/dist/src/cli/handlers/subcommands.js +60 -3
- package/dist/src/cli/handlers/team.js +18 -8
- package/dist/src/cli/handlers/uhp.js +3 -0
- package/dist/src/cli/handlers/use.js +307 -55
- package/dist/src/cli/handlers/utilities.js +125 -26
- package/dist/src/cli/handlers/version.js +8 -0
- package/dist/src/cli/prompt-utils.js +72 -0
- package/dist/src/cli/provider-resolution.js +11 -0
- package/dist/src/cli/router.js +15 -1
- package/dist/src/cli/services/deployment-verification.js +19 -9
- package/dist/src/cli/services/provider-prepare-coordinator.js +24 -0
- package/dist/src/cli/skill-usage.js +2 -3
- package/dist/src/config/aiwg-config.js +349 -35
- package/dist/src/config/cli.js +256 -23
- package/dist/src/config/decision-config.js +106 -0
- package/dist/src/config/dispatch-thresholds-runtime.d.mts +8 -0
- package/dist/src/config/dispatch-thresholds-runtime.mjs +38 -0
- package/dist/src/config/gitignore.js +50 -0
- package/dist/src/config/index-graph-overrides.js +36 -0
- package/dist/src/config/project-artifacts-health.d.mts +37 -0
- package/dist/src/config/project-artifacts-health.mjs +14 -3
- package/dist/src/config/project-artifacts-runtime.d.mts +16 -0
- package/dist/src/config/user-config-dir.d.mts +9 -0
- package/dist/src/config/user-config.js +38 -11
- package/dist/src/config/user-registry.js +23 -15
- package/dist/src/config/user-state.js +7 -0
- package/dist/src/decision/adapters/jev.js +75 -27
- package/dist/src/decision/ask.js +203 -43
- package/dist/src/decision/context-live-qualification.js +2 -2
- package/dist/src/decision/driver.js +14 -7
- package/dist/src/decision/ensemble/aggregate.js +23 -10
- package/dist/src/decision/ensemble-study/multifact-study.js +6 -2
- package/dist/src/decision/entry.js +25 -6
- package/dist/src/decision/graph-live-qualification.js +1 -1
- package/dist/src/decision/graph-run.js +9 -0
- package/dist/src/decision/heldout/collector.js +15 -14
- package/dist/src/decision/heldout/contract.js +30 -7
- package/dist/src/decision/index.js +1 -0
- package/dist/src/decision/interop.js +60 -8
- package/dist/src/decision/jev-credentials.js +15 -1
- package/dist/src/decision/ledger.js +942 -0
- package/dist/src/decision/offload-activation.js +137 -0
- package/dist/src/decision/offload.js +550 -0
- package/dist/src/decision/qualification/load.js +4 -6
- package/dist/src/decision/savings.js +28 -0
- package/dist/src/decision/validate.js +6 -3
- package/dist/src/effects/dispatch-verifier.js +252 -0
- package/dist/src/effects/index.js +1 -0
- package/dist/src/effects/types.js +5 -1
- package/dist/src/effects/verifiers/git.js +2 -1
- package/dist/src/effects/verifiers/tracker.js +26 -14
- package/dist/src/extensions/commands/definitions.js +19 -0
- package/dist/src/extensions/project-local-remove.js +36 -1
- package/dist/src/features/installer.js +2 -2
- package/dist/src/flow/graph-metadata.js +5 -0
- package/dist/src/gates/providers/loader.js +64 -18
- package/dist/src/installation/manager-command.d.mts +18 -0
- package/dist/src/installation/manager-command.mjs +15 -3
- package/dist/src/installation/manager.d.mts +49 -0
- package/dist/src/installation/manager.mjs +95 -5
- package/dist/src/issues/cli.js +4 -4
- package/dist/src/issues/local.js +24 -5
- package/dist/src/jobs/runner.js +1 -1
- package/dist/src/lint/cli.js +27 -1
- package/dist/src/lint/loader.js +2 -1
- package/dist/src/lint/reporters.js +25 -1
- package/dist/src/lint/rule-activation.js +43 -0
- package/dist/src/lint/runner.js +137 -62
- package/dist/src/mcp/adapters/codex-runtime.js +366 -56
- package/dist/src/mcp/claude-install.d.mts +4 -0
- package/dist/src/mcp/claude-install.mjs +41 -0
- package/dist/src/mcp/cli.d.mts +1 -0
- package/dist/src/mcp/cli.mjs +620 -85
- package/dist/src/mcp/config-file.d.mts +28 -0
- package/dist/src/mcp/config-file.mjs +279 -0
- package/dist/src/mcp/config-layers.d.mts +36 -0
- package/dist/src/mcp/config-layers.mjs +348 -0
- package/dist/src/mcp/credentials.d.mts +51 -0
- package/dist/src/mcp/credentials.mjs +484 -0
- package/dist/src/mcp/grok-build-config.d.mts +6 -0
- package/dist/src/mcp/grok-build-config.mjs +17 -27
- package/dist/src/mcp/helpers.mjs +109 -4
- package/dist/src/mcp/muse-native-config.d.mts +13 -0
- package/dist/src/mcp/muse-native-config.mjs +1 -0
- package/dist/src/mcp/omp-config.d.mts +4 -0
- package/dist/src/mcp/omp-config.mjs +50 -29
- package/dist/src/mcp/profiles.js +97 -23
- package/dist/src/mcp/profiles.mjs +99 -27
- package/dist/src/mcp/registry.js +248 -131
- package/dist/src/mcp/registry.mjs +169 -100
- package/dist/src/mcp/server-config.d.mts +3 -0
- package/dist/src/mcp/server-config.mjs +89 -0
- package/dist/src/mcp/server.mjs +127 -82
- package/dist/src/mcp/test-simple.mjs +2 -1
- package/dist/src/mcp/toml-editor.d.mts +4 -0
- package/dist/src/mcp/toml-string.d.mts +1 -0
- package/dist/src/mcp/toml-string.mjs +9 -0
- package/dist/src/mcp/toml-strip-mcp.d.mts +1 -0
- package/dist/src/mcp/toml-strip-mcp.mjs +135 -0
- package/dist/src/mcp/tool-filters.d.mts +46 -0
- package/dist/src/mcp/tool-filters.mjs +357 -0
- package/dist/src/mcp/tools/agentic-sandbox.mjs +3 -1
- package/dist/src/mcp/tools/decision.mjs +22 -3
- package/dist/src/mcp/tools/discovery.mjs +62 -55
- package/dist/src/mcp/tools/orchestration.mjs +50 -2
- package/dist/src/mcp/tools/subsystems.mjs +39 -8
- package/dist/src/mcp/tools/worker-invoke.mjs +2856 -0
- package/dist/src/mcp/tools/worker-shell-control.mjs +289 -0
- package/dist/src/mcp/tools/worker-stdin-runtime.mjs +79 -0
- package/dist/src/memory/project-registry.js +2 -2
- package/dist/src/mission-protocol/codecs.js +647 -1
- package/dist/src/mission-protocol/types.js +110 -0
- package/dist/src/mission-protocol/worker-status.js +2 -0
- package/dist/src/models/config-loader.js +76 -14
- package/dist/src/models/grok-build-models.js +93 -41
- package/dist/src/models/model-capabilities.v1.json +3183 -24
- package/dist/src/models/model-discovery.js +931 -67
- package/dist/src/models/provider-policy.js +719 -11
- package/dist/src/models/qualification-digest.d.mts +2 -0
- package/dist/src/models/qualification-digest.mjs +17 -0
- package/dist/src/models/resolver.js +261 -0
- package/dist/src/models/worker-direct-readiness.js +550 -0
- package/dist/src/models/worker-dispatch-offer.js +169 -0
- package/dist/src/models/worker-health-readiness.js +144 -0
- package/dist/src/models/worker-installation.d.mts +39 -0
- package/dist/src/models/worker-installation.mjs +986 -0
- package/dist/src/models/wrapper-route.js +18 -0
- package/dist/src/ops/registry.js +9 -14
- package/dist/src/plugins/standalone-packager.js +4 -3
- package/dist/src/process/bounded-child-process.d.mts +84 -0
- package/dist/src/process/bounded-child-process.mjs +430 -0
- package/dist/src/process/cli-command.d.mts +16 -0
- package/dist/src/process/cli-command.mjs +75 -0
- package/dist/src/process/signal-child.d.mts +6 -0
- package/dist/src/process/signal-child.mjs +7 -0
- package/dist/src/providers/capability-matrix.js +8 -0
- package/dist/src/providers/capability-matrix.yaml +270 -0
- package/dist/src/providers/deployed-skill-roots.js +20 -0
- package/dist/src/providers/grok-build-acp.js +3 -2
- package/dist/src/providers/grok-build-headless.js +53 -23
- package/dist/src/providers/grok-build-inspect.js +1 -0
- package/dist/src/providers/omp-agent.d.mts +8 -0
- package/dist/src/providers/omp-diagnostics.d.mts +1 -0
- package/dist/src/providers/omp-paths.d.mts +13 -0
- package/dist/src/providers/provider-definitions.js +9 -1
- package/dist/src/providers/provider-definitions.mjs +9 -2
- package/dist/src/providers/skill-ownership.d.mts +9 -0
- package/dist/src/providers/skill-ownership.mjs +88 -0
- package/dist/src/rules/activation.d.mts +21 -0
- package/dist/src/rules/activation.mjs +62 -0
- package/dist/src/rules/inline-budget.d.mts +26 -0
- package/dist/src/rules/inline-budget.mjs +66 -0
- package/dist/src/rules/inventory.js +129 -0
- package/dist/src/rules/pin-state.js +73 -0
- package/dist/src/rules/pins.d.mts +14 -0
- package/dist/src/rules/pins.mjs +112 -0
- package/dist/src/rules/rule-frontmatter.schema.json +197 -0
- package/dist/src/serve/executor-registry.js +16 -24
- package/dist/src/serve/fleet-mission-conductor.js +9 -0
- package/dist/src/serve/mission-conductor.js +47 -12
- package/dist/src/serve/shared-host-scheduler.js +2 -0
- package/dist/src/serve/worker-invocation.js +558 -0
- package/dist/src/serve/worker-stdin-frame.d.mts +10 -0
- package/dist/src/serve/worker-stdin-frame.mjs +107 -0
- package/dist/src/sessions/adapter-registry.js +49 -0
- package/dist/src/sessions/adapters/claude.js +39 -54
- package/dist/src/sessions/adapters/codex.js +82 -67
- package/dist/src/sessions/adapters/copilot.js +4 -4
- package/dist/src/sessions/adapters/cursor.js +40 -57
- package/dist/src/sessions/adapters/deepseek-harness.js +15 -12
- package/dist/src/sessions/adapters/factory.js +31 -27
- package/dist/src/sessions/adapters/generic.js +43 -9
- package/dist/src/sessions/adapters/grok-build.js +11 -11
- package/dist/src/sessions/adapters/grokbot-locator.js +111 -0
- package/dist/src/sessions/adapters/grokbot.js +434 -24
- package/dist/src/sessions/adapters/hermes.js +27 -29
- package/dist/src/sessions/adapters/muse-workspace-scan.js +128 -0
- package/dist/src/sessions/adapters/muse.js +200 -104
- package/dist/src/sessions/adapters/omp.js +28 -14
- package/dist/src/sessions/adapters/openclaw.js +89 -79
- package/dist/src/sessions/adapters/opencode.js +27 -24
- package/dist/src/sessions/adapters/openhuman.js +18 -60
- package/dist/src/sessions/adapters/pi.js +30 -14
- package/dist/src/sessions/adapters/warp.js +3 -3
- package/dist/src/sessions/adapters/windsurf.js +19 -48
- package/dist/src/sessions/batch-contracts.js +25 -5
- package/dist/src/sessions/batch-import.js +72 -51
- package/dist/src/sessions/candidates.js +47 -11
- package/dist/src/sessions/contracts.js +75 -2
- package/dist/src/sessions/coverage-preflight.js +134 -0
- package/dist/src/sessions/discovery.js +3 -0
- package/dist/src/sessions/export-plan.js +4 -3
- package/dist/src/sessions/grok-build-cli.js +67 -5
- package/dist/src/sessions/import-exclusions.js +72 -0
- package/dist/src/sessions/import-lease.js +34 -18
- package/dist/src/sessions/import-limits.js +37 -0
- package/dist/src/sessions/importer.js +84 -46
- package/dist/src/sessions/index.js +2 -0
- package/dist/src/sessions/lifecycle.js +45 -0
- package/dist/src/sessions/policy.js +133 -25
- package/dist/src/sessions/readers.js +106 -53
- package/dist/src/sessions/refresh.js +106 -0
- package/dist/src/sessions/repository.js +199 -63
- package/dist/src/sessions/workspace-discovery.js +315 -88
- package/dist/src/sessions/workspace-matching.js +107 -0
- package/dist/src/skills/adapters/clawhub.js +10 -8
- package/dist/src/skills/adapters/openclaw.js +10 -7
- package/dist/src/skills/importer.js +1 -0
- package/dist/src/smiths/context-pipeline/aiwg-md.js +11 -0
- package/dist/src/smiths/context-pipeline/claude-hook.js +3 -26
- package/dist/src/smiths/context-pipeline/finalization.js +6 -5
- package/dist/src/smiths/context-pipeline/generator.js +21 -4
- package/dist/src/smiths/context-pipeline/parallelism-section.js +195 -14
- package/dist/src/smiths/context-pipeline/workspace-context.js +116 -9
- package/dist/src/smiths/hook-bridge/codex-translator.js +6 -5
- package/dist/src/smiths/mcpsmith/example.js +1 -1
- package/dist/src/smiths/mcpsmith/generator.js +1 -1
- package/dist/src/smiths/toolsmith/runtime-discovery.d.mts +10 -0
- package/dist/src/smiths/toolsmith/runtime-discovery.mjs +85 -31
- package/dist/src/storage/backends/fs.js +18 -76
- package/dist/src/storage/backends/logseq.js +68 -7
- package/dist/src/storage/backends/obsidian.js +1 -0
- package/dist/src/storage/fortemi-qualification-receipt.js +2 -2
- package/dist/src/testing/generators/test-code-generator.js +57 -30
- package/dist/src/tracker/forge-http.js +2 -1
- package/dist/src/uhp/client.js +11 -1
- package/dist/src/uhp/mission.js +5 -0
- package/dist/src/update/checker.d.mts +2 -0
- package/dist/src/update/checker.mjs +5 -5
- package/dist/src/update/notifier.mjs +54 -2
- package/dist/src/update/service.d.mts +22 -0
- package/dist/src/utils/contained-filesystem.d.mts +37 -0
- package/dist/src/utils/contained-filesystem.mjs +683 -0
- package/dist/src/utils/temporary-directory.js +36 -0
- package/dist/src/writing/example-generator.js +1 -1
- package/dist/src/writing/fidelity.js +18 -1
- package/package.json +32 -2
- package/schemas/mission-v1.schema.json +2429 -0
- package/schemas/models/model-catalog.v1.schema.json +301 -0
- package/schemas/models/model-config-compatibility.v1.schema.json +281 -0
- package/schemas/models/model-policy.v1.schema.json +14 -0
- package/schemas/models/provider-model-capabilities.v1.schema.json +1072 -0
- package/tools/_resolve-impl.mjs +39 -2
- package/tools/agents/deploy-agents.mjs +64 -23
- package/tools/agents/providers/base.mjs +153 -166
- package/tools/agents/providers/claude.mjs +8 -24
- package/tools/agents/providers/codex.mjs +18 -11
- package/tools/agents/providers/cursor.mjs +19 -18
- package/tools/agents/providers/grok-build.mjs +3 -1
- package/tools/agents/providers/grokbot.mjs +11 -12
- package/tools/agents/providers/hermes.mjs +62 -49
- package/tools/agents/providers/omp.mjs +5 -2
- package/tools/agents/providers/openclaw-translator.mjs +19 -5
- package/tools/agents/providers/openclaw.mjs +9 -4
- package/tools/agents/providers/pi.mjs +5 -0
- package/tools/agents/providers/provider-prepare-channel.mjs +5 -0
- package/tools/agents/providers/provider-prepare-coordinator.mjs +247 -0
- package/tools/agents/providers/provider-prepare-worker.mjs +84 -0
- package/tools/agents/providers/rule-delivery.mjs +1270 -0
- package/tools/agents/providers/warp.mjs +20 -26
- package/tools/cli/decision-offload-report.mjs +40 -0
- package/tools/cli/workspace-status.mjs +862 -0
- package/tools/plugin/package-plugins.mjs +186 -8
- package/tools/plugin/plugin-links.mjs +114 -0
- package/tools/providers/antigravity-transport.mjs +3 -1
- package/tools/providers/deepseek-harness-transport.mjs +360 -0
- package/tools/providers/omp-transport.mjs +194 -0
- package/tools/ralph-external/lib/claude-adapter.mjs +389 -0
- package/tools/ralph-external/lib/codex-adapter.mjs +432 -0
- package/tools/ralph-external/lib/consecutive-failure-circuit-breaker.mjs +1748 -0
- package/tools/ralph-external/lib/deepseek-harness-adapter.mjs +397 -0
- package/tools/ralph-external/lib/factory-adapter.mjs +503 -0
- package/tools/ralph-external/lib/launcher-recovery-evidence.mjs +55 -0
- package/tools/ralph-external/lib/muse-adapter.mjs +364 -0
- package/tools/ralph-external/lib/omp-adapter.mjs +315 -0
- package/tools/ralph-external/lib/opencode-adapter.mjs +575 -0
- package/tools/ralph-external/lib/openhuman-adapter.mjs +75 -0
- package/tools/ralph-external/lib/pi-adapter.mjs +329 -0
- package/tools/ralph-external/lib/provider-adapter.mjs +748 -0
- package/tools/ralph-external/lib/recovery-probe.mjs +72 -0
- package/tools/ralph-external/lib/session-environment.mjs +28 -0
- package/tools/ralph-external/lib/systemd-client.mjs +49 -0
- package/tools/ralph-external/lib/worker-health.mjs +439 -0
- package/tools/ralph-external/lib/worker-isolation.mjs +717 -0
- package/tools/ralph-external/lib/worker-overflow.mjs +50 -0
- package/tools/ralph-external/process-monitor.mjs +1017 -0
- package/tools/ralph-external/session-launcher.mjs +5057 -0
- package/tools/scripts/resource-preflight.mjs +541 -0
- package/tools/skills/deploy-skills-codex.mjs +2 -1
- package/vscode-extension/schemas/aiwg.config.v1.json +2916 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { basename } from 'node:path';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { SessionContractError, assertSupportedSchemaMajor, } from '../contracts.js';
|
|
4
|
-
import {
|
|
3
|
+
import { schemaRejectionDetail, schemaIssueDetail, SessionContractError, assertSupportedSchemaMajor, } from '../contracts.js';
|
|
4
|
+
import { streamBoundedJsonLines, } from '../readers.js';
|
|
5
5
|
export const DEVIN_DESKTOP_ADAPTER_VERSION = '1.1.0';
|
|
6
6
|
export const DEVIN_DESKTOP_TRANSCRIPT_SCHEMA_VERSION = '1.0.0';
|
|
7
7
|
/** @deprecated Compatibility export. */
|
|
@@ -38,19 +38,14 @@ export class DevinDesktopSessionAdapter {
|
|
|
38
38
|
// Deliberately empty: hook enablement and transcript selection are explicit user actions.
|
|
39
39
|
}
|
|
40
40
|
async inspect(source) {
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
41
|
+
const records = this.stream(source);
|
|
42
|
+
let result = await records.next();
|
|
43
|
+
while (!result.done)
|
|
44
|
+
result = await records.next();
|
|
45
|
+
return result.value;
|
|
47
46
|
}
|
|
48
47
|
async *stream(source, cursor) {
|
|
49
|
-
|
|
50
|
-
// Preserve the precise unsupported-operation diagnostics.
|
|
51
|
-
await this.readSource(source);
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
48
|
+
this.assertSupportedLocator(source);
|
|
54
49
|
const start = parseCursor(cursor?.value);
|
|
55
50
|
const input = await streamBoundedJsonLines({
|
|
56
51
|
selectedPath: source.locator,
|
|
@@ -62,12 +57,12 @@ export class DevinDesktopSessionAdapter {
|
|
|
62
57
|
for await (const line of input) {
|
|
63
58
|
const parsed = StepSchema.safeParse(line.value);
|
|
64
59
|
if (!parsed.success) {
|
|
65
|
-
throw new SessionContractError('MALFORMED_SOURCE', 'Windsurf transcript step is malformed');
|
|
60
|
+
throw new SessionContractError('MALFORMED_SOURCE', 'Windsurf transcript step is malformed', schemaRejectionDetail(parsed.error));
|
|
66
61
|
}
|
|
67
62
|
const step = parsed.data;
|
|
68
63
|
const currentVersion = step.schema_version ?? DEVIN_DESKTOP_TRANSCRIPT_SCHEMA_VERSION;
|
|
69
64
|
if (schemaVersion && schemaVersion !== currentVersion) {
|
|
70
|
-
throw new SessionContractError('SCHEMA_DRIFT', 'mixed Windsurf transcript schemas');
|
|
65
|
+
throw new SessionContractError('SCHEMA_DRIFT', 'mixed Windsurf transcript schemas', schemaIssueDetail('schema_version'));
|
|
71
66
|
}
|
|
72
67
|
schemaVersion = currentVersion;
|
|
73
68
|
assertSupportedSchemaMajor(schemaVersion);
|
|
@@ -75,7 +70,7 @@ export class DevinDesktopSessionAdapter {
|
|
|
75
70
|
?? nativeSessionId
|
|
76
71
|
?? basename(source.locator, '.jsonl');
|
|
77
72
|
if (step.trajectory_id && nativeSessionId && step.trajectory_id !== nativeSessionId) {
|
|
78
|
-
throw new SessionContractError('SCHEMA_DRIFT', 'mixed Windsurf trajectory identities');
|
|
73
|
+
throw new SessionContractError('SCHEMA_DRIFT', 'mixed Windsurf trajectory identities', schemaIssueDetail('trajectory_id'));
|
|
79
74
|
}
|
|
80
75
|
nativeSessionId = currentSession;
|
|
81
76
|
if (seen++ < start)
|
|
@@ -83,45 +78,21 @@ export class DevinDesktopSessionAdapter {
|
|
|
83
78
|
yield normalizeStep(step, currentSession, line.sequence, line.byteOffset, canonicalLocatorClass(source.locatorClass), schemaVersion);
|
|
84
79
|
}
|
|
85
80
|
if (seen === 0) {
|
|
86
|
-
throw new SessionContractError('MALFORMED_SOURCE', 'Windsurf transcript is empty or malformed');
|
|
81
|
+
throw new SessionContractError('MALFORMED_SOURCE', 'Windsurf transcript is empty or malformed', schemaIssueDetail('<root>'));
|
|
87
82
|
}
|
|
83
|
+
return {
|
|
84
|
+
sourceSchemaVersion: schemaVersion,
|
|
85
|
+
consistency: 'provisional',
|
|
86
|
+
operationalState: 'available',
|
|
87
|
+
};
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
assertSupportedLocator(source) {
|
|
90
90
|
if (isLegacyLocator(source.locatorClass)) {
|
|
91
91
|
throw new SessionContractError('UNSUPPORTED_OPERATION', 'legacy Devin Desktop/Windsurf protobuf stores are unsupported; enable post_cascade_response_with_transcript and select its JSONL output');
|
|
92
92
|
}
|
|
93
93
|
if (!isCurrentHookLocator(source.locatorClass)) {
|
|
94
94
|
throw new SessionContractError('UNSUPPORTED_OPERATION', 'Devin Desktop (Windsurf compatibility) requires an explicitly selected post_cascade_response_with_transcript JSONL file');
|
|
95
95
|
}
|
|
96
|
-
const input = await readBoundedJsonLines({
|
|
97
|
-
selectedPath: source.locator,
|
|
98
|
-
allowedRoots: source.authorizedScope.allowedRoots,
|
|
99
|
-
}, { consistency: 'provisional', limits: this.limits });
|
|
100
|
-
if (input.records.length === 0) {
|
|
101
|
-
throw new SessionContractError('MALFORMED_SOURCE', 'Windsurf transcript is empty or malformed');
|
|
102
|
-
}
|
|
103
|
-
const steps = input.records.map((record) => {
|
|
104
|
-
const parsed = StepSchema.safeParse(record.value);
|
|
105
|
-
if (!parsed.success) {
|
|
106
|
-
throw new SessionContractError('MALFORMED_SOURCE', 'Windsurf transcript step is malformed');
|
|
107
|
-
}
|
|
108
|
-
return { ...record, value: parsed.data };
|
|
109
|
-
});
|
|
110
|
-
const versions = new Set(steps.map(({ value }) => value.schema_version ?? DEVIN_DESKTOP_TRANSCRIPT_SCHEMA_VERSION));
|
|
111
|
-
if (versions.size !== 1) {
|
|
112
|
-
throw new SessionContractError('SCHEMA_DRIFT', 'mixed Windsurf transcript schemas');
|
|
113
|
-
}
|
|
114
|
-
const schemaVersion = [...versions][0];
|
|
115
|
-
assertSupportedSchemaMajor(schemaVersion);
|
|
116
|
-
const trajectoryIds = new Set(steps.flatMap(({ value }) => value.trajectory_id ? [value.trajectory_id] : []));
|
|
117
|
-
if (trajectoryIds.size > 1) {
|
|
118
|
-
throw new SessionContractError('SCHEMA_DRIFT', 'mixed Windsurf trajectory identities');
|
|
119
|
-
}
|
|
120
|
-
const nativeSessionId = [...trajectoryIds][0] ?? basename(source.locator, '.jsonl');
|
|
121
|
-
return {
|
|
122
|
-
schemaVersion,
|
|
123
|
-
records: steps.map(({ value, sequence, byteOffset }) => normalizeStep(value, nativeSessionId, sequence, byteOffset, canonicalLocatorClass(source.locatorClass), schemaVersion)),
|
|
124
|
-
};
|
|
125
96
|
}
|
|
126
97
|
}
|
|
127
98
|
/** @deprecated Use DevinDesktopSessionAdapter; retained through the alias window. */
|
|
@@ -206,7 +177,7 @@ function parseCursor(value) {
|
|
|
206
177
|
if (!value)
|
|
207
178
|
return 0;
|
|
208
179
|
if (!/^\d+$/.test(value))
|
|
209
|
-
throw new SessionContractError('SCHEMA_DRIFT', 'invalid Windsurf cursor');
|
|
180
|
+
throw new SessionContractError('SCHEMA_DRIFT', 'invalid Windsurf cursor', schemaIssueDetail('cursor'));
|
|
210
181
|
return Number(value);
|
|
211
182
|
}
|
|
212
183
|
//# sourceMappingURL=windsurf.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export const
|
|
1
|
+
import { reconcileCoveragePreflight } from './coverage-preflight.js';
|
|
2
|
+
export const BATCH_IMPORT_VERSION = '2.0.0';
|
|
3
|
+
export const COVERAGE_VERSION = '2.0.0';
|
|
3
4
|
export function coverageFromBatchRun(run, now = new Date(), staleAfterMs = 24 * 60 * 60 * 1_000) {
|
|
4
5
|
if (!run)
|
|
5
6
|
return unknownCoverage();
|
|
@@ -8,6 +9,7 @@ export function coverageFromBatchRun(run, now = new Date(), staleAfterMs = 24 *
|
|
|
8
9
|
]);
|
|
9
10
|
const accepted = run.sources.filter((source) => source.status === 'committed').length;
|
|
10
11
|
const rejected = run.sources.filter((source) => source.status === 'rejected').length;
|
|
12
|
+
const excluded = run.sources.filter(source => source.status === 'excluded').length;
|
|
11
13
|
const skipped = run.sources.filter((source) => source.status === 'skipped').length;
|
|
12
14
|
const duplicated = run.sources.filter((source) => source.status === 'duplicate').length;
|
|
13
15
|
const previouslyCommitted = run.sources.filter((source) => source.status === 'previously-committed').length;
|
|
@@ -18,7 +20,13 @@ export function coverageFromBatchRun(run, now = new Date(), staleAfterMs = 24 *
|
|
|
18
20
|
const notChecked = providerNames(run, 'not-checked');
|
|
19
21
|
const manifestAgeMs = Math.max(0, now.getTime() - Date.parse(run.manifestCreatedAt));
|
|
20
22
|
const isStale = manifestAgeMs > staleAfterMs;
|
|
21
|
-
const
|
|
23
|
+
const preflight = run.preflight ? reconcileCoveragePreflight(run.preflight, run.sources) : undefined;
|
|
24
|
+
const unresolvedProviders = preflight?.unresolvedProviders
|
|
25
|
+
?? [...new Set([...unavailable, ...exportRequired, ...notChecked])].sort();
|
|
26
|
+
const acquisitionIncomplete = rejected > 0 || pending > 0 || skipped > 0
|
|
27
|
+
|| (preflight?.expectedProviderBasis === 'explicit' && unresolvedProviders.length > 0);
|
|
28
|
+
const incomplete = acquisitionIncomplete || !preflight || preflight.status !== 'complete'
|
|
29
|
+
|| unavailable.length > 0 || accepted + duplicated + previouslyCommitted + excluded === 0
|
|
22
30
|
|| exportRequired.length > 0 || notChecked.length > 0;
|
|
23
31
|
const rejectionCounts = {};
|
|
24
32
|
for (const source of run.sources) {
|
|
@@ -36,6 +44,9 @@ export function coverageFromBatchRun(run, now = new Date(), staleAfterMs = 24 *
|
|
|
36
44
|
.map((source) => source.updatedAt)
|
|
37
45
|
.sort();
|
|
38
46
|
const remediation = [
|
|
47
|
+
...(preflight?.ledger.flatMap((entry) => entry.remediation ? [entry.remediation] : []) ?? ['Legacy receipt lacks provider/runtime preflight; rediscover with --expected-providers.']),
|
|
48
|
+
...(preflight && ['mismatch', 'stale', 'unknown'].includes(preflight.runtime.installationState)
|
|
49
|
+
? ['Inspect the recorded runtime identity and deliberately select a compatible installation; then rediscover. No automatic switch is performed.'] : []),
|
|
39
50
|
...(rejected > 0
|
|
40
51
|
? ['Run `aiwg sessions import-discovered --resume --confirm` after correcting rejected sources.']
|
|
41
52
|
: []),
|
|
@@ -47,6 +58,10 @@ export function coverageFromBatchRun(run, now = new Date(), staleAfterMs = 24 *
|
|
|
47
58
|
return {
|
|
48
59
|
schemaVersion: COVERAGE_VERSION,
|
|
49
60
|
status: isStale ? 'stale' : incomplete ? 'partial' : 'complete',
|
|
61
|
+
acquisitionStatus: acquisitionIncomplete ? 'partial' : 'complete',
|
|
62
|
+
unresolvedProviders,
|
|
63
|
+
preflight,
|
|
64
|
+
semanticReview: 'not-assessed',
|
|
50
65
|
workspaceId: run.workspaceId,
|
|
51
66
|
manifestId: run.manifestId,
|
|
52
67
|
batchRunId: run.runId,
|
|
@@ -57,6 +72,7 @@ export function coverageFromBatchRun(run, now = new Date(), staleAfterMs = 24 *
|
|
|
57
72
|
discovered: run.sources.length,
|
|
58
73
|
accepted,
|
|
59
74
|
rejected,
|
|
75
|
+
excluded,
|
|
60
76
|
skipped,
|
|
61
77
|
duplicated,
|
|
62
78
|
previouslyCommitted,
|
|
@@ -64,9 +80,9 @@ export function coverageFromBatchRun(run, now = new Date(), staleAfterMs = 24 *
|
|
|
64
80
|
},
|
|
65
81
|
sessionsAccepted: run.sources.reduce((sum, source) => sum + source.sessionsAccepted, 0),
|
|
66
82
|
eventsAccepted: run.sources.reduce((sum, source) => sum + source.eventsAccepted, 0),
|
|
67
|
-
coverageRatio: run.sources.length ===
|
|
83
|
+
coverageRatio: run.sources.length === excluded
|
|
68
84
|
? null
|
|
69
|
-
: (accepted + duplicated + previouslyCommitted) / run.sources.length,
|
|
85
|
+
: (accepted + duplicated + previouslyCommitted) / (run.sources.length - excluded),
|
|
70
86
|
rejectionCounts,
|
|
71
87
|
sourceDateRange: {
|
|
72
88
|
earliest: sourceTimestamps.at(0) ?? null,
|
|
@@ -89,6 +105,9 @@ function unknownCoverage() {
|
|
|
89
105
|
return {
|
|
90
106
|
schemaVersion: COVERAGE_VERSION,
|
|
91
107
|
status: 'unknown',
|
|
108
|
+
acquisitionStatus: 'unknown',
|
|
109
|
+
unresolvedProviders: [],
|
|
110
|
+
semanticReview: 'not-assessed',
|
|
92
111
|
workspaceId: '',
|
|
93
112
|
manifestId: null,
|
|
94
113
|
batchRunId: null,
|
|
@@ -104,6 +123,7 @@ function unknownCoverage() {
|
|
|
104
123
|
discovered: 0,
|
|
105
124
|
accepted: 0,
|
|
106
125
|
rejected: 0,
|
|
126
|
+
excluded: 0,
|
|
107
127
|
skipped: 0,
|
|
108
128
|
duplicated: 0,
|
|
109
129
|
previouslyCommitted: 0,
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { OmpSessionAdapter, OMP_ADAPTER_VERSION } from './adapters/omp.js';
|
|
2
|
-
import { DeepSeekHarnessSessionAdapter, DEEPSEEK_HARNESS_ADAPTER_VERSION } from './adapters/deepseek-harness.js';
|
|
3
1
|
import { stat } from 'node:fs/promises';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { FACTORY_ADAPTER_VERSION, FactorySessionAdapter, } from './adapters/factory.js';
|
|
8
|
-
import { MUSE_ADAPTER_VERSION, MuseSessionAdapter, } from './adapters/muse.js';
|
|
9
|
-
import { SESSION_CONTRACT_VERSION, SessionContractError, SessionSourceSchema, sha256, } from './contracts.js';
|
|
2
|
+
import { createSessionAdapterRegistry } from './adapter-registry.js';
|
|
3
|
+
import { coveragePreflight, sessionRuntimeIdentity } from './coverage-preflight.js';
|
|
4
|
+
import { SESSION_CONTRACT_VERSION, SessionContractError, schemaIssueDetail, SessionSourceSchema, sha256, } from './contracts.js';
|
|
10
5
|
import { BATCH_IMPORT_VERSION, coverageFromBatchRun, } from './batch-contracts.js';
|
|
11
6
|
import { IncrementalSessionImporter, SessionImportFailure } from './importer.js';
|
|
7
|
+
import { matchImportExclusion, resolveImportExclusions } from './import-exclusions.js';
|
|
8
|
+
import { resolveImportLimits } from './import-limits.js';
|
|
12
9
|
import { fingerprintSourceFile } from './readers.js';
|
|
13
10
|
export async function importDiscoveryManifest(options) {
|
|
11
|
+
const exclusions = resolveImportExclusions(undefined, options.exclude);
|
|
12
|
+
const limits = { ...resolveImportLimits(undefined, {
|
|
13
|
+
maxRecordBytes: options.limits?.maxRecordBytes, maxSourceBytes: options.limits?.maxTotalBytes,
|
|
14
|
+
}), ...options.limits };
|
|
14
15
|
const now = options.now ?? (() => new Date());
|
|
15
16
|
const runId = sha256([
|
|
16
17
|
'workspace-import-v1',
|
|
@@ -22,6 +23,13 @@ export async function importDiscoveryManifest(options) {
|
|
|
22
23
|
if (run.runId !== runId) {
|
|
23
24
|
throw new SessionContractError('IMPORT_CONFLICT', 'discovery manifest is already associated with a different batch run');
|
|
24
25
|
}
|
|
26
|
+
run.schemaVersion = BATCH_IMPORT_VERSION;
|
|
27
|
+
run.preflight = coveragePreflight({
|
|
28
|
+
expectedProviders: options.manifest.preflight?.expectedProviders,
|
|
29
|
+
expectedProviderBasis: options.manifest.preflight?.expectedProviderBasis ?? 'legacy',
|
|
30
|
+
runtime: options.runtime ?? sessionRuntimeIdentity(),
|
|
31
|
+
reports: options.manifest.providers,
|
|
32
|
+
});
|
|
25
33
|
run.status = 'running';
|
|
26
34
|
run.updatedAt = now().toISOString();
|
|
27
35
|
run.completedAt = null;
|
|
@@ -32,6 +40,12 @@ export async function importDiscoveryManifest(options) {
|
|
|
32
40
|
if (!disposition) {
|
|
33
41
|
throw new SessionContractError('IMPORT_CONFLICT', `batch run is missing discovered source ${manifestSource.sourceId}`);
|
|
34
42
|
}
|
|
43
|
+
const exclusion = matchImportExclusion(manifestSource, exclusions) ?? manifestSource.exclusion;
|
|
44
|
+
if (exclusion) {
|
|
45
|
+
excludeSource(disposition, exclusion, now());
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
delete disposition.exclusion;
|
|
35
49
|
if (isAccepted(disposition.status)) {
|
|
36
50
|
disposition.status = 'previously-committed';
|
|
37
51
|
disposition.updatedAt = now().toISOString();
|
|
@@ -47,6 +61,7 @@ export async function importDiscoveryManifest(options) {
|
|
|
47
61
|
disposition.attempts += 1;
|
|
48
62
|
disposition.errorCode = null;
|
|
49
63
|
disposition.diagnostic = null;
|
|
64
|
+
disposition.detail = null;
|
|
50
65
|
disposition.updatedAt = now().toISOString();
|
|
51
66
|
persistProgress(options.repository, run, now());
|
|
52
67
|
try {
|
|
@@ -61,7 +76,7 @@ export async function importDiscoveryManifest(options) {
|
|
|
61
76
|
allowedRoots: [manifestSource.authorizedRoot],
|
|
62
77
|
},
|
|
63
78
|
};
|
|
64
|
-
const adapter = adapterFor(manifestSource.provider);
|
|
79
|
+
const adapter = adapterFor(manifestSource.provider, limits);
|
|
65
80
|
const source = await sessionSource(selectedSource, adapter);
|
|
66
81
|
const receipts = await new IncrementalSessionImporter(options.repository).import({
|
|
67
82
|
source,
|
|
@@ -73,6 +88,7 @@ export async function importDiscoveryManifest(options) {
|
|
|
73
88
|
publish: false,
|
|
74
89
|
signal: options.signal,
|
|
75
90
|
inactivityThresholdMs: options.inactivityThresholdMs,
|
|
91
|
+
limits,
|
|
76
92
|
});
|
|
77
93
|
await assertManifestSourceUnchanged(manifestSource);
|
|
78
94
|
const totals = options.repository.sourceImportTotals(manifestSource.sourceId, run.runId);
|
|
@@ -88,10 +104,12 @@ export async function importDiscoveryManifest(options) {
|
|
|
88
104
|
catch (error) {
|
|
89
105
|
disposition.status = 'rejected';
|
|
90
106
|
disposition.errorCode = importErrorCode(error);
|
|
107
|
+
disposition.detail = error instanceof SessionContractError ? error.detail ?? null : null;
|
|
91
108
|
disposition.diagnostic = [
|
|
92
109
|
`provider=${manifestSource.provider}`,
|
|
93
110
|
`source=${manifestSource.sourceId}`,
|
|
94
111
|
`code=${disposition.errorCode}`,
|
|
112
|
+
...(disposition.detail ? [`detail=${JSON.stringify(disposition.detail)}`] : []),
|
|
95
113
|
].join(' ');
|
|
96
114
|
}
|
|
97
115
|
disposition.updatedAt = now().toISOString();
|
|
@@ -100,14 +118,14 @@ export async function importDiscoveryManifest(options) {
|
|
|
100
118
|
}
|
|
101
119
|
const rejected = run.sources.some((source) => source.status === 'rejected');
|
|
102
120
|
const pending = run.sources.some((source) => source.status === 'pending' || source.status === 'running');
|
|
103
|
-
const
|
|
121
|
+
const acquisitionIncomplete = coverageFromBatchRun(run, now()).acquisitionStatus !== 'complete';
|
|
104
122
|
const publishable = run.sources
|
|
105
123
|
.filter((source) => isAccepted(source.status))
|
|
106
124
|
.map((source) => source.sourceId);
|
|
107
125
|
injectFault(options, run, 'before-publication');
|
|
108
126
|
options.repository.commitStagedBatch(run.runId, publishable);
|
|
109
127
|
injectFault(options, run, 'after-publication');
|
|
110
|
-
run.status = pending ? 'interrupted' : rejected ||
|
|
128
|
+
run.status = pending ? 'interrupted' : rejected || acquisitionIncomplete ? 'partial' : 'complete';
|
|
111
129
|
run.updatedAt = now().toISOString();
|
|
112
130
|
run.completedAt = pending ? null : run.updatedAt;
|
|
113
131
|
options.repository.saveBatchImportRun(run);
|
|
@@ -127,9 +145,26 @@ function injectFault(options, run, boundary, sourceId) {
|
|
|
127
145
|
throw error;
|
|
128
146
|
}
|
|
129
147
|
}
|
|
130
|
-
export function previewDiscoveryImport(manifest, existing, now = new Date()) {
|
|
148
|
+
export function previewDiscoveryImport(manifest, existing, now = new Date(), exclude = []) {
|
|
131
149
|
const run = existing ?? newBatchRun(manifest, sha256(['workspace-import-v1', manifest.manifestId, manifest.workspaceId].join('\0')), now);
|
|
132
|
-
|
|
150
|
+
const exclusions = resolveImportExclusions(undefined, exclude);
|
|
151
|
+
return receiptFor({
|
|
152
|
+
...run,
|
|
153
|
+
sources: run.sources.map(source => {
|
|
154
|
+
const manifestSource = manifest.sources.find(candidate => candidate.sourceId === source.sourceId);
|
|
155
|
+
const exclusion = matchImportExclusion(manifestSource, exclusions) ?? manifestSource.exclusion;
|
|
156
|
+
if (!exclusion)
|
|
157
|
+
return source;
|
|
158
|
+
const disposition = { ...source };
|
|
159
|
+
excludeSource(disposition, exclusion, now);
|
|
160
|
+
return disposition;
|
|
161
|
+
}),
|
|
162
|
+
preflight: coveragePreflight({
|
|
163
|
+
expectedProviders: manifest.preflight?.expectedProviders,
|
|
164
|
+
expectedProviderBasis: manifest.preflight?.expectedProviderBasis ?? 'legacy',
|
|
165
|
+
reports: manifest.providers,
|
|
166
|
+
}),
|
|
167
|
+
}, now);
|
|
133
168
|
}
|
|
134
169
|
function newBatchRun(manifest, runId, now) {
|
|
135
170
|
const timestamp = now.toISOString();
|
|
@@ -143,11 +178,14 @@ function newBatchRun(manifest, runId, now) {
|
|
|
143
178
|
startedAt: timestamp,
|
|
144
179
|
updatedAt: timestamp,
|
|
145
180
|
completedAt: null,
|
|
181
|
+
preflight: manifest.preflight,
|
|
182
|
+
discoveryRuntime: manifest.preflight?.runtime,
|
|
146
183
|
providers: manifest.providers,
|
|
147
184
|
sources: manifest.sources.map((source) => ({
|
|
148
185
|
sourceId: source.sourceId,
|
|
149
186
|
provider: source.provider,
|
|
150
|
-
status: 'pending',
|
|
187
|
+
status: source.status ?? 'pending',
|
|
188
|
+
...(source.exclusion ? { exclusion: source.exclusion } : {}),
|
|
151
189
|
attempts: 0,
|
|
152
190
|
sessionsAccepted: 0,
|
|
153
191
|
eventsAccepted: 0,
|
|
@@ -163,10 +201,12 @@ function receiptFor(run, now) {
|
|
|
163
201
|
schemaVersion: BATCH_IMPORT_VERSION,
|
|
164
202
|
run,
|
|
165
203
|
coverage,
|
|
204
|
+
interruptedRuns: [],
|
|
166
205
|
totals: {
|
|
167
206
|
discovered: coverage.sources.discovered,
|
|
168
207
|
accepted: coverage.sources.accepted,
|
|
169
208
|
rejected: coverage.sources.rejected,
|
|
209
|
+
excluded: coverage.sources.excluded,
|
|
170
210
|
skipped: coverage.sources.skipped,
|
|
171
211
|
duplicated: coverage.sources.duplicated,
|
|
172
212
|
previouslyCommitted: coverage.sources.previouslyCommitted,
|
|
@@ -176,6 +216,16 @@ function receiptFor(run, now) {
|
|
|
176
216
|
},
|
|
177
217
|
};
|
|
178
218
|
}
|
|
219
|
+
function excludeSource(source, exclusion, now) {
|
|
220
|
+
source.status = 'excluded';
|
|
221
|
+
source.exclusion = exclusion;
|
|
222
|
+
source.errorCode = null;
|
|
223
|
+
source.diagnostic = null;
|
|
224
|
+
source.detail = null;
|
|
225
|
+
source.sessionsAccepted = 0;
|
|
226
|
+
source.eventsAccepted = 0;
|
|
227
|
+
source.updatedAt = now.toISOString();
|
|
228
|
+
}
|
|
179
229
|
function persistProgress(repository, run, now) {
|
|
180
230
|
run.updatedAt = now.toISOString();
|
|
181
231
|
repository.saveBatchImportRun(run);
|
|
@@ -186,35 +236,21 @@ async function assertManifestSourceUnchanged(source) {
|
|
|
186
236
|
details = await stat(source.locator);
|
|
187
237
|
}
|
|
188
238
|
catch {
|
|
189
|
-
throw new SessionContractError('SCHEMA_DRIFT', 'discovered source is no longer available; run discovery again');
|
|
239
|
+
throw new SessionContractError('SCHEMA_DRIFT', 'discovered source is no longer available; run discovery again', schemaIssueDetail('locator'));
|
|
190
240
|
}
|
|
191
241
|
if (details.size !== source.sizeBytes || details.mtime.toISOString() !== source.modifiedAt) {
|
|
192
|
-
throw new SessionContractError('SCHEMA_DRIFT', 'discovered source changed after manifest creation; run discovery again');
|
|
242
|
+
throw new SessionContractError('SCHEMA_DRIFT', 'discovered source changed after manifest creation; run discovery again', schemaIssueDetail(details.size !== source.sizeBytes ? 'sizeBytes' : 'modifiedAt'));
|
|
193
243
|
}
|
|
194
244
|
const fingerprint = await fingerprintSourceFile({
|
|
195
245
|
selectedPath: source.locator,
|
|
196
246
|
allowedRoots: [source.authorizedRoot],
|
|
197
247
|
});
|
|
198
248
|
if (fingerprint.digest !== source.digest || fingerprint.size !== source.sizeBytes) {
|
|
199
|
-
throw new SessionContractError('SCHEMA_DRIFT', 'discovered source content changed after manifest creation; run discovery again');
|
|
249
|
+
throw new SessionContractError('SCHEMA_DRIFT', 'discovered source content changed after manifest creation; run discovery again', schemaIssueDetail('digest'));
|
|
200
250
|
}
|
|
201
251
|
}
|
|
202
|
-
function adapterFor(provider) {
|
|
203
|
-
|
|
204
|
-
return new DeepSeekHarnessSessionAdapter();
|
|
205
|
-
if (provider === 'omp')
|
|
206
|
-
return new OmpSessionAdapter();
|
|
207
|
-
if (provider === 'claude')
|
|
208
|
-
return new ClaudeSessionAdapter();
|
|
209
|
-
if (provider === 'codex')
|
|
210
|
-
return new CodexSessionAdapter();
|
|
211
|
-
if (provider === 'cursor')
|
|
212
|
-
return new CursorSessionAdapter();
|
|
213
|
-
if (provider === 'factory')
|
|
214
|
-
return new FactorySessionAdapter();
|
|
215
|
-
if (provider === 'muse')
|
|
216
|
-
return new MuseSessionAdapter();
|
|
217
|
-
throw new SessionContractError('UNSUPPORTED_OPERATION', `batch discovery import is not implemented for ${provider}`);
|
|
252
|
+
function adapterFor(provider, limits) {
|
|
253
|
+
return createSessionAdapterRegistry(limits).get(provider);
|
|
218
254
|
}
|
|
219
255
|
async function sessionSource(selected, adapter) {
|
|
220
256
|
const probe = await adapter.inspect(selected);
|
|
@@ -225,7 +261,7 @@ async function sessionSource(selected, adapter) {
|
|
|
225
261
|
providerProfile: providerProfile(selected.provider, selected.locatorClass),
|
|
226
262
|
locatorClass: selected.locatorClass,
|
|
227
263
|
redactedLocator: '<discovered-session-source>',
|
|
228
|
-
adapterVersion: adapterVersion
|
|
264
|
+
adapterVersion: adapter.adapterVersion,
|
|
229
265
|
sourceSchemaVersion: probe.sourceSchemaVersion,
|
|
230
266
|
disposition: 'implemented',
|
|
231
267
|
operationalState: probe.operationalState,
|
|
@@ -234,23 +270,6 @@ async function sessionSource(selected, adapter) {
|
|
|
234
270
|
extensions: { [`native.${selected.provider}`]: {} },
|
|
235
271
|
});
|
|
236
272
|
}
|
|
237
|
-
function adapterVersion(provider) {
|
|
238
|
-
if (provider === 'deepseek-harness')
|
|
239
|
-
return DEEPSEEK_HARNESS_ADAPTER_VERSION;
|
|
240
|
-
if (provider === 'omp')
|
|
241
|
-
return OMP_ADAPTER_VERSION;
|
|
242
|
-
if (provider === 'claude')
|
|
243
|
-
return CLAUDE_ADAPTER_VERSION;
|
|
244
|
-
if (provider === 'codex')
|
|
245
|
-
return CODEX_ADAPTER_VERSION;
|
|
246
|
-
if (provider === 'cursor')
|
|
247
|
-
return CURSOR_ADAPTER_VERSION;
|
|
248
|
-
if (provider === 'factory')
|
|
249
|
-
return FACTORY_ADAPTER_VERSION;
|
|
250
|
-
if (provider === 'muse')
|
|
251
|
-
return MUSE_ADAPTER_VERSION;
|
|
252
|
-
return '1.0.0';
|
|
253
|
-
}
|
|
254
273
|
function providerProfile(provider, locatorClass) {
|
|
255
274
|
if (provider === 'deepseek-harness')
|
|
256
275
|
return 'native-session-v2-jsonl';
|
|
@@ -269,6 +288,8 @@ function providerProfile(provider, locatorClass) {
|
|
|
269
288
|
return 'documented-project-jsonl';
|
|
270
289
|
if (provider === 'muse')
|
|
271
290
|
return 'muse-native-session-log-v1';
|
|
291
|
+
if (provider === 'grokbot')
|
|
292
|
+
return 'grokbot-native-transcript-replica-v1';
|
|
272
293
|
return 'manual-interchange';
|
|
273
294
|
}
|
|
274
295
|
function importErrorCode(error) {
|
|
@@ -103,17 +103,21 @@ export class StructuralCandidateExtractor {
|
|
|
103
103
|
const drafts = [];
|
|
104
104
|
for (const item of evidence) {
|
|
105
105
|
let offset = 0;
|
|
106
|
-
for (const
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
106
|
+
for (const rawLine of item.text.split(/\n/)) {
|
|
107
|
+
const line = rawLine.endsWith('\r') ? rawLine.slice(0, -1) : rawLine;
|
|
108
|
+
const separator = line.indexOf(':');
|
|
109
|
+
const label = line.slice(0, separator).normalize('NFKC').toLowerCase();
|
|
110
|
+
const remainder = line.slice(separator + 1);
|
|
111
|
+
const content = remainder.trimStart();
|
|
112
|
+
if (separator >= 0 && Object.hasOwn(STRUCTURAL_TYPES, label)
|
|
113
|
+
&& remainder.length > 0 && !/[\r\u2028\u2029]/u.test(content || remainder.slice(-1))) {
|
|
114
|
+
const assertion = content.trim();
|
|
115
|
+
const start = offset + separator + 1 + remainder.length - content.length;
|
|
112
116
|
const type = STRUCTURAL_TYPES[label];
|
|
113
117
|
const relationship = type === 'relationship'
|
|
114
118
|
? parseRelationship(assertion)
|
|
115
119
|
: { subject: null, predicate: null, object: null };
|
|
116
|
-
if (type && (type !== 'relationship' || relationship.subject)) {
|
|
120
|
+
if (type && assertion && (type !== 'relationship' || relationship.subject)) {
|
|
117
121
|
drafts.push({
|
|
118
122
|
type,
|
|
119
123
|
assertion,
|
|
@@ -125,7 +129,7 @@ export class StructuralCandidateExtractor {
|
|
|
125
129
|
});
|
|
126
130
|
}
|
|
127
131
|
}
|
|
128
|
-
offset +=
|
|
132
|
+
offset += rawLine.length + 1;
|
|
129
133
|
}
|
|
130
134
|
}
|
|
131
135
|
return drafts;
|
|
@@ -134,7 +138,6 @@ export class StructuralCandidateExtractor {
|
|
|
134
138
|
const SECURITY_POLICY_VERSION = '1.0.0';
|
|
135
139
|
const INSTRUCTION_PATTERN = /\b(?:ignore|override|disregard)\b.{0,40}\b(?:instruction|prompt|policy|rule)s?\b|\b(?:system|developer)\s+(?:message|instruction|prompt)\b|\b(?:execute|invoke|run)\b.{0,30}\b(?:tool|command|shell|script)\b/i;
|
|
136
140
|
const SECRET_PATTERN = /\b(?:api[_-]?key|access[_-]?token|password|passwd|private[_-]?key|authorization|cookie|secret)\b\s*(?:[:=]|\bis\b)/i;
|
|
137
|
-
const STRUCTURE_PATTERN = /(?:^|\n)\s*(?:---|\.\.\.)\s*(?:\n|$)|```|~~~|<[/!?A-Za-z]|!\[[^\]]*\]\(|\[[^\]]+\]\([^)]*\)|\{\{|\{%/;
|
|
138
141
|
const CONTROL_PATTERN = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f]/;
|
|
139
142
|
const BIDI_PATTERN = /[\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/u;
|
|
140
143
|
const LATIN_PATTERN = /\p{Script=Latin}/u;
|
|
@@ -146,7 +149,7 @@ export function classifyCandidateSecurity(input) {
|
|
|
146
149
|
const warnings = [];
|
|
147
150
|
if (INSTRUCTION_PATTERN.test(text))
|
|
148
151
|
warnings.push('instruction-like');
|
|
149
|
-
if (
|
|
152
|
+
if (hasStructureBreakingContent(text))
|
|
150
153
|
warnings.push('structure-breaking');
|
|
151
154
|
if (CONTROL_PATTERN.test(text))
|
|
152
155
|
warnings.push('control-character');
|
|
@@ -175,7 +178,40 @@ function evidenceSupportsAssertion(assertion, quote) {
|
|
|
175
178
|
const quoteTokens = tokens(quote);
|
|
176
179
|
return [...assertionTokens].some((token) => quoteTokens.has(token));
|
|
177
180
|
}
|
|
178
|
-
|
|
181
|
+
function hasStructureBreakingContent(text) {
|
|
182
|
+
if (/```|~~~|<[/!?A-Za-z]|\{\{|\{%/.test(text))
|
|
183
|
+
return true;
|
|
184
|
+
for (const line of text.split('\n')) {
|
|
185
|
+
const trimmed = line.trim();
|
|
186
|
+
if (trimmed === '---' || trimmed === '...')
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
let bracket = -1;
|
|
190
|
+
let image = false;
|
|
191
|
+
let link = false;
|
|
192
|
+
for (let index = 0; index < text.length; index++) {
|
|
193
|
+
if (text[index] === '[') {
|
|
194
|
+
if (bracket < 0)
|
|
195
|
+
bracket = index;
|
|
196
|
+
if (index > 0 && text[index - 1] === '!')
|
|
197
|
+
image = true;
|
|
198
|
+
}
|
|
199
|
+
else if (text[index] === ']') {
|
|
200
|
+
if (text[index + 1] === '(') {
|
|
201
|
+
if (image)
|
|
202
|
+
return true;
|
|
203
|
+
if (bracket >= 0 && index > bracket + 1)
|
|
204
|
+
link = true;
|
|
205
|
+
}
|
|
206
|
+
bracket = -1;
|
|
207
|
+
image = false;
|
|
208
|
+
}
|
|
209
|
+
else if (text[index] === ')' && link) {
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
179
215
|
const STRUCTURAL_TYPES = {
|
|
180
216
|
decision: 'decision',
|
|
181
217
|
requirement: 'requirement',
|