@codemieai/code 0.11.0 → 0.13.0
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 +109 -56
- package/bin/codemie-copilot.js +224 -0
- package/bin/codemie-pi.js +18 -0
- package/dist/agents/core/AgentCLI.d.ts.map +1 -1
- package/dist/agents/core/AgentCLI.js +16 -10
- package/dist/agents/core/AgentCLI.js.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.d.ts.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.js +43 -19
- package/dist/agents/core/BaseAgentAdapter.js.map +1 -1
- package/dist/agents/core/agent-aliases.d.ts +17 -0
- package/dist/agents/core/agent-aliases.d.ts.map +1 -0
- package/dist/agents/core/agent-aliases.js +41 -0
- package/dist/agents/core/agent-aliases.js.map +1 -0
- package/dist/agents/core/session/BaseSessionAdapter.d.ts +19 -0
- package/dist/agents/core/session/BaseSessionAdapter.d.ts.map +1 -1
- package/dist/agents/core/session/session-origin-audit.d.ts +13 -0
- package/dist/agents/core/session/session-origin-audit.d.ts.map +1 -1
- package/dist/agents/core/session/session-origin-audit.js +34 -0
- package/dist/agents/core/session/session-origin-audit.js.map +1 -1
- package/dist/agents/core/session/stale-session-reconciliation.d.ts +42 -0
- package/dist/agents/core/session/stale-session-reconciliation.d.ts.map +1 -0
- package/dist/agents/core/session/stale-session-reconciliation.js +141 -0
- package/dist/agents/core/session/stale-session-reconciliation.js.map +1 -0
- package/dist/agents/core/session/types.d.ts +19 -0
- package/dist/agents/core/session/types.d.ts.map +1 -1
- package/dist/agents/core/session/types.js +17 -1
- package/dist/agents/core/session/types.js.map +1 -1
- package/dist/agents/core/types.d.ts +11 -0
- package/dist/agents/core/types.d.ts.map +1 -1
- package/dist/agents/plugins/codex/codex.reconciliation.d.ts +15 -35
- package/dist/agents/plugins/codex/codex.reconciliation.d.ts.map +1 -1
- package/dist/agents/plugins/codex/codex.reconciliation.js +8 -139
- package/dist/agents/plugins/codex/codex.reconciliation.js.map +1 -1
- package/dist/agents/plugins/copilot-cli/copilot-cli-event-types.d.ts +146 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli-event-types.d.ts.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli-event-types.js +12 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli-event-types.js.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.constants.d.ts +15 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.constants.d.ts.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.constants.js +15 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.constants.js.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.models.d.ts +8 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.models.d.ts.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.models.js +195 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.models.js.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.paths.d.ts +11 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.paths.d.ts.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.paths.js +21 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.paths.js.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.plugin.d.ts +14 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.plugin.d.ts.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.plugin.js +263 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.plugin.js.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.session.d.ts +43 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.session.d.ts.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.session.js +343 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.session.js.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.storage-utils.d.ts +10 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.storage-utils.d.ts.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.storage-utils.js +41 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.storage-utils.js.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.usage.d.ts +37 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.usage.d.ts.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.usage.js +96 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.usage.js.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.workspace.d.ts +17 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.workspace.d.ts.map +1 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.workspace.js +58 -0
- package/dist/agents/plugins/copilot-cli/copilot-cli.workspace.js.map +1 -0
- package/dist/agents/plugins/copilot-cli/index.d.ts +3 -0
- package/dist/agents/plugins/copilot-cli/index.d.ts.map +1 -0
- package/dist/agents/plugins/copilot-cli/index.js +3 -0
- package/dist/agents/plugins/copilot-cli/index.js.map +1 -0
- package/dist/agents/plugins/copilot-cli/session/processors/copilot-cli.conversations-processor.d.ts +18 -0
- package/dist/agents/plugins/copilot-cli/session/processors/copilot-cli.conversations-processor.d.ts.map +1 -0
- package/dist/agents/plugins/copilot-cli/session/processors/copilot-cli.conversations-processor.js +313 -0
- package/dist/agents/plugins/copilot-cli/session/processors/copilot-cli.conversations-processor.js.map +1 -0
- package/dist/agents/plugins/copilot-cli/session/processors/copilot-cli.metrics-processor.d.ts +16 -0
- package/dist/agents/plugins/copilot-cli/session/processors/copilot-cli.metrics-processor.d.ts.map +1 -0
- package/dist/agents/plugins/copilot-cli/session/processors/copilot-cli.metrics-processor.js +22 -0
- package/dist/agents/plugins/copilot-cli/session/processors/copilot-cli.metrics-processor.js.map +1 -0
- package/dist/agents/plugins/pi/__tests__/home-redirect.d.ts +12 -0
- package/dist/agents/plugins/pi/__tests__/home-redirect.d.ts.map +1 -0
- package/dist/agents/plugins/pi/__tests__/home-redirect.js +27 -0
- package/dist/agents/plugins/pi/__tests__/home-redirect.js.map +1 -0
- package/dist/agents/plugins/pi/extension/README.md +68 -0
- package/dist/agents/plugins/pi/extension/index.js +161 -0
- package/dist/agents/plugins/pi/extension/package.json +8 -0
- package/dist/agents/plugins/pi/index.d.ts +3 -0
- package/dist/agents/plugins/pi/index.d.ts.map +1 -0
- package/dist/agents/plugins/pi/index.js +3 -0
- package/dist/agents/plugins/pi/index.js.map +1 -0
- package/dist/agents/plugins/pi/pi.extension.d.ts +60 -0
- package/dist/agents/plugins/pi/pi.extension.d.ts.map +1 -0
- package/dist/agents/plugins/pi/pi.extension.js +201 -0
- package/dist/agents/plugins/pi/pi.extension.js.map +1 -0
- package/dist/agents/plugins/pi/pi.incremental-sync.d.ts +63 -0
- package/dist/agents/plugins/pi/pi.incremental-sync.d.ts.map +1 -0
- package/dist/agents/plugins/pi/pi.incremental-sync.js +266 -0
- package/dist/agents/plugins/pi/pi.incremental-sync.js.map +1 -0
- package/dist/agents/plugins/pi/pi.models.d.ts +20 -0
- package/dist/agents/plugins/pi/pi.models.d.ts.map +1 -0
- package/dist/agents/plugins/pi/pi.models.js +201 -0
- package/dist/agents/plugins/pi/pi.models.js.map +1 -0
- package/dist/agents/plugins/pi/pi.packages.d.ts +11 -0
- package/dist/agents/plugins/pi/pi.packages.d.ts.map +1 -0
- package/dist/agents/plugins/pi/pi.packages.js +35 -0
- package/dist/agents/plugins/pi/pi.packages.js.map +1 -0
- package/dist/agents/plugins/pi/pi.paths.d.ts +37 -0
- package/dist/agents/plugins/pi/pi.paths.d.ts.map +1 -0
- package/dist/agents/plugins/pi/pi.paths.js +146 -0
- package/dist/agents/plugins/pi/pi.paths.js.map +1 -0
- package/dist/agents/plugins/pi/pi.plugin.d.ts +30 -0
- package/dist/agents/plugins/pi/pi.plugin.d.ts.map +1 -0
- package/dist/agents/plugins/pi/pi.plugin.js +453 -0
- package/dist/agents/plugins/pi/pi.plugin.js.map +1 -0
- package/dist/agents/plugins/pi/pi.session.d.ts +114 -0
- package/dist/agents/plugins/pi/pi.session.d.ts.map +1 -0
- package/dist/agents/plugins/pi/pi.session.js +388 -0
- package/dist/agents/plugins/pi/pi.session.js.map +1 -0
- package/dist/agents/plugins/pi/pi.setup.d.ts +2 -0
- package/dist/agents/plugins/pi/pi.setup.d.ts.map +1 -0
- package/dist/agents/plugins/pi/pi.setup.js +33 -0
- package/dist/agents/plugins/pi/pi.setup.js.map +1 -0
- package/dist/agents/plugins/pi/pi.types.d.ts +143 -0
- package/dist/agents/plugins/pi/pi.types.d.ts.map +1 -0
- package/dist/agents/plugins/pi/pi.types.js +74 -0
- package/dist/agents/plugins/pi/pi.types.js.map +1 -0
- package/dist/agents/plugins/pi/session/pi-file-operations.d.ts +17 -0
- package/dist/agents/plugins/pi/session/pi-file-operations.d.ts.map +1 -0
- package/dist/agents/plugins/pi/session/pi-file-operations.js +98 -0
- package/dist/agents/plugins/pi/session/pi-file-operations.js.map +1 -0
- package/dist/agents/plugins/pi/session/pi-named-invocations.d.ts +52 -0
- package/dist/agents/plugins/pi/session/pi-named-invocations.d.ts.map +1 -0
- package/dist/agents/plugins/pi/session/pi-named-invocations.js +189 -0
- package/dist/agents/plugins/pi/session/pi-named-invocations.js.map +1 -0
- package/dist/agents/plugins/pi/session/pi-user-prompt.d.ts +14 -0
- package/dist/agents/plugins/pi/session/pi-user-prompt.d.ts.map +1 -0
- package/dist/agents/plugins/pi/session/pi-user-prompt.js +51 -0
- package/dist/agents/plugins/pi/session/pi-user-prompt.js.map +1 -0
- package/dist/agents/plugins/pi/session/processors/pi.conversations-processor.d.ts +52 -0
- package/dist/agents/plugins/pi/session/processors/pi.conversations-processor.d.ts.map +1 -0
- package/dist/agents/plugins/pi/session/processors/pi.conversations-processor.js +716 -0
- package/dist/agents/plugins/pi/session/processors/pi.conversations-processor.js.map +1 -0
- package/dist/agents/plugins/pi/session/processors/pi.metrics-processor.d.ts +104 -0
- package/dist/agents/plugins/pi/session/processors/pi.metrics-processor.d.ts.map +1 -0
- package/dist/agents/plugins/pi/session/processors/pi.metrics-processor.js +595 -0
- package/dist/agents/plugins/pi/session/processors/pi.metrics-processor.js.map +1 -0
- package/dist/agents/registry.d.ts +20 -0
- package/dist/agents/registry.d.ts.map +1 -1
- package/dist/agents/registry.js +29 -2
- package/dist/agents/registry.js.map +1 -1
- package/dist/cli/commands/analytics/agent-labels.d.ts +3 -0
- package/dist/cli/commands/analytics/agent-labels.d.ts.map +1 -0
- package/dist/cli/commands/analytics/agent-labels.js +20 -0
- package/dist/cli/commands/analytics/agent-labels.js.map +1 -0
- package/dist/cli/commands/analytics/cost/cost-enricher.d.ts.map +1 -1
- package/dist/cli/commands/analytics/cost/cost-enricher.js +12 -0
- package/dist/cli/commands/analytics/cost/cost-enricher.js.map +1 -1
- package/dist/cli/commands/analytics/cost/types.d.ts +10 -0
- package/dist/cli/commands/analytics/cost/types.d.ts.map +1 -1
- package/dist/cli/commands/analytics/cost/usage-readers.d.ts +24 -0
- package/dist/cli/commands/analytics/cost/usage-readers.d.ts.map +1 -1
- package/dist/cli/commands/analytics/cost/usage-readers.js +253 -54
- package/dist/cli/commands/analytics/cost/usage-readers.js.map +1 -1
- package/dist/cli/commands/analytics/formatter.d.ts.map +1 -1
- package/dist/cli/commands/analytics/formatter.js +10 -2
- package/dist/cli/commands/analytics/formatter.js.map +1 -1
- package/dist/cli/commands/analytics/index.d.ts.map +1 -1
- package/dist/cli/commands/analytics/index.js +22 -0
- package/dist/cli/commands/analytics/index.js.map +1 -1
- package/dist/cli/commands/analytics/native-loader.d.ts +21 -4
- package/dist/cli/commands/analytics/native-loader.d.ts.map +1 -1
- package/dist/cli/commands/analytics/native-loader.js +267 -88
- package/dist/cli/commands/analytics/native-loader.js.map +1 -1
- package/dist/cli/commands/analytics/report/client/app.js +77 -15
- package/dist/cli/commands/analytics/report/payload-builder.d.ts.map +1 -1
- package/dist/cli/commands/analytics/report/payload-builder.js +32 -2
- package/dist/cli/commands/analytics/report/payload-builder.js.map +1 -1
- package/dist/cli/commands/analytics/report/types.d.ts +11 -0
- package/dist/cli/commands/analytics/report/types.d.ts.map +1 -1
- package/dist/cli/commands/hook.d.ts.map +1 -1
- package/dist/cli/commands/hook.js +71 -29
- package/dist/cli/commands/hook.js.map +1 -1
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +9 -7
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/list.d.ts.map +1 -1
- package/dist/cli/commands/list.js +4 -2
- package/dist/cli/commands/list.js.map +1 -1
- package/dist/cli/commands/setup.d.ts +3 -1
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +87 -63
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/cli/commands/uninstall.d.ts.map +1 -1
- package/dist/cli/commands/uninstall.js +6 -4
- package/dist/cli/commands/uninstall.js.map +1 -1
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +7 -5
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/first-time.d.ts.map +1 -1
- package/dist/cli/first-time.js +10 -9
- package/dist/cli/first-time.js.map +1 -1
- package/dist/providers/core/auth-validation.d.ts +7 -2
- package/dist/providers/core/auth-validation.d.ts.map +1 -1
- package/dist/providers/core/auth-validation.js +11 -5
- package/dist/providers/core/auth-validation.js.map +1 -1
- package/dist/providers/core/types.d.ts +16 -0
- package/dist/providers/core/types.d.ts.map +1 -1
- package/dist/providers/core/types.js.map +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/claude-request-normalizer.plugin.d.ts +8 -3
- package/dist/providers/plugins/sso/proxy/plugins/claude-request-normalizer.plugin.d.ts.map +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/claude-request-normalizer.plugin.js +46 -11
- package/dist/providers/plugins/sso/proxy/plugins/claude-request-normalizer.plugin.js.map +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/codex-encrypted-content-sanitizer.plugin.d.ts +23 -13
- package/dist/providers/plugins/sso/proxy/plugins/codex-encrypted-content-sanitizer.plugin.d.ts.map +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/codex-encrypted-content-sanitizer.plugin.js +75 -18
- package/dist/providers/plugins/sso/proxy/plugins/codex-encrypted-content-sanitizer.plugin.js.map +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/copilot-encrypted-content-sanitizer.plugin.d.ts +21 -0
- package/dist/providers/plugins/sso/proxy/plugins/copilot-encrypted-content-sanitizer.plugin.d.ts.map +1 -0
- package/dist/providers/plugins/sso/proxy/plugins/copilot-encrypted-content-sanitizer.plugin.js +133 -0
- package/dist/providers/plugins/sso/proxy/plugins/copilot-encrypted-content-sanitizer.plugin.js.map +1 -0
- package/dist/providers/plugins/sso/proxy/plugins/header-injection.plugin.js +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/header-injection.plugin.js.map +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/index.d.ts +2 -1
- package/dist/providers/plugins/sso/proxy/plugins/index.d.ts.map +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/index.js +4 -2
- package/dist/providers/plugins/sso/proxy/plugins/index.js.map +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/types.d.ts +11 -0
- package/dist/providers/plugins/sso/proxy/plugins/types.d.ts.map +1 -1
- package/dist/providers/plugins/sso/proxy/sso.proxy.d.ts +2 -0
- package/dist/providers/plugins/sso/proxy/sso.proxy.d.ts.map +1 -1
- package/dist/providers/plugins/sso/proxy/sso.proxy.js +37 -1
- package/dist/providers/plugins/sso/proxy/sso.proxy.js.map +1 -1
- package/dist/providers/plugins/sso/session/SessionSyncer.d.ts.map +1 -1
- package/dist/providers/plugins/sso/session/SessionSyncer.js +13 -0
- package/dist/providers/plugins/sso/session/SessionSyncer.js.map +1 -1
- package/dist/providers/plugins/sso/session/processors/conversations/syncProcessor.js +6 -0
- package/dist/providers/plugins/sso/session/processors/conversations/syncProcessor.js.map +1 -1
- package/dist/providers/plugins/sso/session/processors/metrics/metrics-post-processor.d.ts +0 -6
- package/dist/providers/plugins/sso/session/processors/metrics/metrics-post-processor.d.ts.map +1 -1
- package/dist/providers/plugins/sso/session/processors/metrics/metrics-post-processor.js +28 -19
- package/dist/providers/plugins/sso/session/processors/metrics/metrics-post-processor.js.map +1 -1
- package/dist/providers/plugins/sso/sso.setup-steps.d.ts.map +1 -1
- package/dist/providers/plugins/sso/sso.setup-steps.js +39 -22
- package/dist/providers/plugins/sso/sso.setup-steps.js.map +1 -1
- package/dist/utils/interactive.d.ts +14 -0
- package/dist/utils/interactive.d.ts.map +1 -0
- package/dist/utils/interactive.js +16 -0
- package/dist/utils/interactive.js.map +1 -0
- package/package.json +6 -5
- package/scripts/copy-plugins.js +6 -0
- package/scripts/release.sh +54 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-origin-audit.js","sourceRoot":"","sources":["../../../../src/agents/core/session/session-origin-audit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"session-origin-audit.js","sourceRoot":"","sources":["../../../../src/agents/core/session/session-origin-audit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE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uB;YAC7B,IAAI,EAAE,UAAU,EAAE;YAClB,kBAAkB,EAAE,gBAAgB;YACpC,aAAa,EAAE,YAAY;YAC3B,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC,GAAG,IAAI,CACV,CAAC;QACF,MAAM,CAAC,KAAK,CAAC,kDAAkD,cAAc,EAAE,CAAC,CAAC;IACnF,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,CAAC,KAAK,CAAC,mEAAmE,GAAG,EAAE,CAAC,CAAC;IACzF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { HookProcessingConfig } from '../../../cli/commands/hook.js';
|
|
2
|
+
export interface ReconciliationOptions {
|
|
3
|
+
/** Sessions inactive for longer than this are considered stale. */
|
|
4
|
+
inactivityThresholdMs?: number;
|
|
5
|
+
/** Sessions started before (now - this) are skipped. */
|
|
6
|
+
maxLookbackMs?: number;
|
|
7
|
+
/** Override clock for tests. */
|
|
8
|
+
now?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface ReconcileOptions extends ReconciliationOptions {
|
|
11
|
+
/** Injected for tests. Defaults to the real `processEvent` from the hook module. */
|
|
12
|
+
processEvent?: ProcessEventFn;
|
|
13
|
+
}
|
|
14
|
+
export interface StaleSession {
|
|
15
|
+
sessionId: string;
|
|
16
|
+
startTime: number;
|
|
17
|
+
lastActivityMs: number;
|
|
18
|
+
}
|
|
19
|
+
export interface SessionEndEventLike {
|
|
20
|
+
hook_event_name: 'SessionEnd';
|
|
21
|
+
session_id: string;
|
|
22
|
+
transcript_path: string;
|
|
23
|
+
permission_mode: string;
|
|
24
|
+
cwd: string;
|
|
25
|
+
reason: string;
|
|
26
|
+
}
|
|
27
|
+
export type ProcessEventFn = (event: SessionEndEventLike, config: HookProcessingConfig) => Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Find sessions of `agentName` in `~/.codemie/sessions/` that look stranded.
|
|
30
|
+
*/
|
|
31
|
+
export declare function findStaleSessions(agentName: string, opts?: ReconciliationOptions): Promise<StaleSession[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Synthesise a SessionEnd for each stale session of `agentName`.
|
|
34
|
+
*
|
|
35
|
+
* `processEvent` is injected so tests can drive this without touching the hook
|
|
36
|
+
* module's network and SSO-credential code paths.
|
|
37
|
+
*/
|
|
38
|
+
export declare function reconcileStaleSessions(agentName: string, env: NodeJS.ProcessEnv, buildHookConfig: (env: NodeJS.ProcessEnv, sessionId: string) => HookProcessingConfig, opts?: ReconcileOptions): Promise<{
|
|
39
|
+
reconciled: number;
|
|
40
|
+
failed: number;
|
|
41
|
+
}>;
|
|
42
|
+
//# sourceMappingURL=stale-session-reconciliation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stale-session-reconciliation.d.ts","sourceRoot":"","sources":["../../../../src/agents/core/session/stale-session-reconciliation.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAQnE,MAAM,WAAW,qBAAqB;IACpC,mEAAmE;IACnE,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,wDAAwD;IACxD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gCAAgC;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAiB,SAAQ,qBAAqB;IAC7D,oFAAoF;IACpF,YAAY,CAAC,EAAE,cAAc,CAAC;CAC/B;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,YAAY,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,cAAc,GAAG,CAC3B,KAAK,EAAE,mBAAmB,EAC1B,MAAM,EAAE,oBAAoB,KACzB,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,EACjB,IAAI,GAAE,qBAA0B,GAC/B,OAAO,CAAC,YAAY,EAAE,CAAC,CAwDzB;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,eAAe,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,SAAS,EAAE,MAAM,KAAK,oBAAoB,EACpF,IAAI,GAAE,gBAAqB,GAC1B,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAoCjD"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stale-Session Reconciliation
|
|
3
|
+
*
|
|
4
|
+
* Agent runs that are killed hard (kill -9, OS shutdown, a closed terminal, the
|
|
5
|
+
* parent process dying) never reach `onSessionEnd`. Their session JSON in
|
|
6
|
+
* `~/.codemie/sessions/{id}.json` stays `status: "active"` forever and no terminal
|
|
7
|
+
* `codemie_cli_session_total` lifecycle metric is emitted, so server-side analytics
|
|
8
|
+
* see them as never-finishing.
|
|
9
|
+
*
|
|
10
|
+
* On `onSessionStart`, an agent scans for such stranded sessions of its own kind and
|
|
11
|
+
* synthesises a SessionEnd with `reason: "interrupted"` to finalise them.
|
|
12
|
+
*
|
|
13
|
+
* Inactivity threshold defaults to 30 minutes; the lookback window is capped to
|
|
14
|
+
* 24 hours so a first deploy does not emit a burst of synthetic events for ancient
|
|
15
|
+
* stranded sessions.
|
|
16
|
+
*/
|
|
17
|
+
import { readdir, readFile } from 'fs/promises';
|
|
18
|
+
import { existsSync } from 'fs';
|
|
19
|
+
import { basename, join } from 'path';
|
|
20
|
+
import { getCodemiePath } from '../../../utils/paths.js';
|
|
21
|
+
import { logger } from '../../../utils/logger.js';
|
|
22
|
+
const DEFAULT_INACTIVITY_THRESHOLD_MS = 30 * 60 * 1000;
|
|
23
|
+
const DEFAULT_MAX_LOOKBACK_MS = 24 * 60 * 60 * 1000;
|
|
24
|
+
/**
|
|
25
|
+
* Find sessions of `agentName` in `~/.codemie/sessions/` that look stranded.
|
|
26
|
+
*/
|
|
27
|
+
export async function findStaleSessions(agentName, opts = {}) {
|
|
28
|
+
const now = opts.now ?? Date.now();
|
|
29
|
+
const inactivityThresholdMs = opts.inactivityThresholdMs ?? DEFAULT_INACTIVITY_THRESHOLD_MS;
|
|
30
|
+
const maxLookbackMs = opts.maxLookbackMs ?? DEFAULT_MAX_LOOKBACK_MS;
|
|
31
|
+
const sessionsDir = getCodemiePath('sessions');
|
|
32
|
+
if (!existsSync(sessionsDir)) {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
let entries;
|
|
36
|
+
try {
|
|
37
|
+
entries = await readdir(sessionsDir);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
logger.debug(`[${agentName}-reconciliation] Failed to read sessions dir`, error);
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
const stale = [];
|
|
44
|
+
const cutoffActivity = now - inactivityThresholdMs;
|
|
45
|
+
const cutoffStart = now - maxLookbackMs;
|
|
46
|
+
for (const entry of entries) {
|
|
47
|
+
if (!entry.endsWith('.json'))
|
|
48
|
+
continue;
|
|
49
|
+
if (entry.startsWith('completed_'))
|
|
50
|
+
continue;
|
|
51
|
+
if (entry.includes('_metrics') || entry.includes('_conversation'))
|
|
52
|
+
continue;
|
|
53
|
+
const filePath = join(sessionsDir, entry);
|
|
54
|
+
let session;
|
|
55
|
+
try {
|
|
56
|
+
const content = await readFile(filePath, 'utf-8');
|
|
57
|
+
session = JSON.parse(content);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
logger.debug(`[${agentName}-reconciliation] Skipping unreadable file ${basename(filePath)}`, error);
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (session.agentName !== agentName)
|
|
64
|
+
continue;
|
|
65
|
+
if (session.status !== 'active')
|
|
66
|
+
continue;
|
|
67
|
+
if (typeof session.startTime !== 'number')
|
|
68
|
+
continue;
|
|
69
|
+
if (session.startTime < cutoffStart)
|
|
70
|
+
continue;
|
|
71
|
+
const lastActivity = computeLastActivity(session);
|
|
72
|
+
if (lastActivity > cutoffActivity)
|
|
73
|
+
continue;
|
|
74
|
+
stale.push({
|
|
75
|
+
sessionId: session.sessionId,
|
|
76
|
+
startTime: session.startTime,
|
|
77
|
+
lastActivityMs: lastActivity,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return stale;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Synthesise a SessionEnd for each stale session of `agentName`.
|
|
84
|
+
*
|
|
85
|
+
* `processEvent` is injected so tests can drive this without touching the hook
|
|
86
|
+
* module's network and SSO-credential code paths.
|
|
87
|
+
*/
|
|
88
|
+
export async function reconcileStaleSessions(agentName, env, buildHookConfig, opts = {}) {
|
|
89
|
+
const stale = await findStaleSessions(agentName, opts);
|
|
90
|
+
if (stale.length === 0) {
|
|
91
|
+
return { reconciled: 0, failed: 0 };
|
|
92
|
+
}
|
|
93
|
+
logger.info(`[${agentName}-reconciliation] Found ${stale.length} stranded ${agentName} session(s); reconciling`);
|
|
94
|
+
const processEvent = opts.processEvent ?? (await loadDefaultProcessEvent());
|
|
95
|
+
let reconciled = 0;
|
|
96
|
+
let failed = 0;
|
|
97
|
+
for (const entry of stale) {
|
|
98
|
+
try {
|
|
99
|
+
const event = {
|
|
100
|
+
hook_event_name: 'SessionEnd',
|
|
101
|
+
session_id: entry.sessionId,
|
|
102
|
+
transcript_path: '',
|
|
103
|
+
permission_mode: 'default',
|
|
104
|
+
cwd: process.cwd(),
|
|
105
|
+
reason: 'interrupted',
|
|
106
|
+
};
|
|
107
|
+
await processEvent(event, buildHookConfig(env, entry.sessionId));
|
|
108
|
+
reconciled++;
|
|
109
|
+
logger.info(`[${agentName}-reconciliation] Reconciled stranded session ${entry.sessionId}`);
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
failed++;
|
|
113
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
114
|
+
logger.warn(`[${agentName}-reconciliation] Failed to reconcile ${entry.sessionId}: ${msg}`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return { reconciled, failed };
|
|
118
|
+
}
|
|
119
|
+
function computeLastActivity(session) {
|
|
120
|
+
const candidates = [];
|
|
121
|
+
if (typeof session.startTime === 'number')
|
|
122
|
+
candidates.push(session.startTime);
|
|
123
|
+
const metrics = session.sync?.metrics;
|
|
124
|
+
if (metrics) {
|
|
125
|
+
if (typeof metrics.lastSyncAt === 'number')
|
|
126
|
+
candidates.push(metrics.lastSyncAt);
|
|
127
|
+
if (typeof metrics.lastProcessedTimestamp === 'number') {
|
|
128
|
+
candidates.push(metrics.lastProcessedTimestamp);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
const conversations = session.sync?.conversations;
|
|
132
|
+
if (conversations && typeof conversations.lastSyncAt === 'number') {
|
|
133
|
+
candidates.push(conversations.lastSyncAt);
|
|
134
|
+
}
|
|
135
|
+
return candidates.length === 0 ? 0 : Math.max(...candidates);
|
|
136
|
+
}
|
|
137
|
+
async function loadDefaultProcessEvent() {
|
|
138
|
+
const mod = await import('../../../cli/commands/hook.js');
|
|
139
|
+
return mod.processEvent;
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=stale-session-reconciliation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stale-session-reconciliation.js","sourceRoot":"","sources":["../../../../src/agents/core/session/stale-session-reconciliation.ts"],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AAG,CAAC,YAAyC,CAAC;AACvD,CAAC"}
|
|
@@ -30,6 +30,24 @@ export interface CorrelationResult {
|
|
|
30
30
|
* Session status
|
|
31
31
|
*/
|
|
32
32
|
export type SessionStatus = 'active' | 'completed' | 'recovered' | 'failed';
|
|
33
|
+
/**
|
|
34
|
+
* Session origin — whether this session is safe to ingest.
|
|
35
|
+
* CODEMIE: created through CodeMie tooling (default when unset, for back-compat with
|
|
36
|
+
* existing session files). EXTERNAL_RESUME: a confirmed resume of a Claude transcript
|
|
37
|
+
* that was never created through CodeMie — must never be synced (metrics or conversations).
|
|
38
|
+
*/
|
|
39
|
+
export declare const SESSION_ORIGIN: {
|
|
40
|
+
readonly CODEMIE: "codemie";
|
|
41
|
+
readonly EXTERNAL_RESUME: "external-resume";
|
|
42
|
+
};
|
|
43
|
+
export type SessionOrigin = (typeof SESSION_ORIGIN)[keyof typeof SESSION_ORIGIN];
|
|
44
|
+
/**
|
|
45
|
+
* Env var carrying the resume-ownership decision from AgentCLI into the spawned agent
|
|
46
|
+
* subprocess (and, transitively, into `codemie hook` invocations it shells out to).
|
|
47
|
+
* Holds a SESSION_ORIGIN value; kept separate from the object above because it names
|
|
48
|
+
* the channel, not an origin.
|
|
49
|
+
*/
|
|
50
|
+
export declare const SESSION_ORIGIN_ENV_KEY = "CODEMIE_SESSION_ORIGIN";
|
|
33
51
|
/**
|
|
34
52
|
* Sync status (used by all processors)
|
|
35
53
|
*/
|
|
@@ -97,6 +115,7 @@ export interface Session {
|
|
|
97
115
|
correlation: CorrelationResult;
|
|
98
116
|
status: SessionStatus;
|
|
99
117
|
reason?: string;
|
|
118
|
+
origin?: SessionOrigin;
|
|
100
119
|
activityStartedAt?: number;
|
|
101
120
|
activeDurationMs: number;
|
|
102
121
|
sync?: SyncState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/agents/core/session/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;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EAAE,MAAM,CAAC;IAGpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,aAAa,CAAC,EAAE,sBAAsB,CAAC;CACxC;AAED,MAAM,WAAW,iBAAiB;IAChC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,OAAO;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,WAAW,EAAE,iBAAiB,CAAC;IAC/B,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,aAAa,CAAC;IAGvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IAGzB,IAAI,CAAC,EAAE,SAAS,CAAC;IAGjB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC"}
|
|
@@ -4,5 +4,21 @@
|
|
|
4
4
|
* Core type definitions for session management system.
|
|
5
5
|
* These types are shared across metrics, conversations, and other processors.
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Session origin — whether this session is safe to ingest.
|
|
9
|
+
* CODEMIE: created through CodeMie tooling (default when unset, for back-compat with
|
|
10
|
+
* existing session files). EXTERNAL_RESUME: a confirmed resume of a Claude transcript
|
|
11
|
+
* that was never created through CodeMie — must never be synced (metrics or conversations).
|
|
12
|
+
*/
|
|
13
|
+
export const SESSION_ORIGIN = {
|
|
14
|
+
CODEMIE: 'codemie',
|
|
15
|
+
EXTERNAL_RESUME: 'external-resume',
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Env var carrying the resume-ownership decision from AgentCLI into the spawned agent
|
|
19
|
+
* subprocess (and, transitively, into `codemie hook` invocations it shells out to).
|
|
20
|
+
* Holds a SESSION_ORIGIN value; kept separate from the object above because it names
|
|
21
|
+
* the channel, not an origin.
|
|
22
|
+
*/
|
|
23
|
+
export const SESSION_ORIGIN_ENV_KEY = 'CODEMIE_SESSION_ORIGIN';
|
|
8
24
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/agents/core/session/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/agents/core/session/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAgCH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,OAAO,EAAE,SAAS;IAClB,eAAe,EAAE,iBAAiB;CAC1B,CAAC;AAIX;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,wBAAwB,CAAC"}
|
|
@@ -265,6 +265,16 @@ export interface AgentMetadata {
|
|
|
265
265
|
binary?: string;
|
|
266
266
|
};
|
|
267
267
|
analyticsAdapter?: AgentAnalyticsAdapter;
|
|
268
|
+
/**
|
|
269
|
+
* True for agents CodeMie only reads analytics for and never installs, launches,
|
|
270
|
+
* or manages (e.g. GitHub Copilot CLI).
|
|
271
|
+
*
|
|
272
|
+
* Such an agent can never carry a CodeMie ownership marker, so the analytics
|
|
273
|
+
* ownership gate must not apply to it — see `isAnalyticsOnlyAgent` in
|
|
274
|
+
* `src/cli/commands/analytics/native-loader.ts`. Applying the gate would tag every
|
|
275
|
+
* one of its sessions `native-external` and drop them from the default report.
|
|
276
|
+
*/
|
|
277
|
+
analyticsOnly?: boolean;
|
|
268
278
|
/**
|
|
269
279
|
* When true, a per-session analytics JSON report is written automatically on
|
|
270
280
|
* session exit (see BaseAgentAdapter finalization). Default off; enabled on the
|
|
@@ -560,6 +570,7 @@ export interface AgentHookConfig {
|
|
|
560
570
|
export interface BaseHookEvent {
|
|
561
571
|
session_id: string;
|
|
562
572
|
transcript_path: string;
|
|
573
|
+
transcript_paths?: string[];
|
|
563
574
|
permission_mode: string;
|
|
564
575
|
hook_event_name: string;
|
|
565
576
|
cwd?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/agents/core/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtE;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC;AAErC;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,YAAY,GAAG,YAAY,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,iCAAiC;IACjC,IAAI,EAAE,eAAe,CAAC;IAEtB,2DAA2D;IAC3D,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CAC/B;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,YAAY;IAC3B,CAAC,UAAU,EAAE,MAAM,GAAG,WAAW,CAAC;CACnC;AAMD,MAAM,MAAM,wBAAwB,GAChC,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAE5D,MAAM,MAAM,uBAAuB,GAAG,UAAU,GAAG,YAAY,GAAG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;IAE7D;;;;;;OAMG;IACH,oBAAoB,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAEnE;;;OAGG;IACH,cAAc,CAAC,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAEzD;;;OAGG;IACH,yBAAyB,CAAC,IAAI,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAElE;;;;;;OAMG;IACH,qBAAqB,CAAC,IAAI,OAAO,CAAC,KAAK,GAAG,QAAQ,GAAG,SAAS,CAAC,CAAC;CACjE"}
|
|
@@ -1,43 +1,23 @@
|
|
|
1
|
-
import type { HookProcessingConfig } from '../../../cli/commands/hook.js';
|
|
2
|
-
export interface ReconciliationOptions {
|
|
3
|
-
/** Sessions inactive for longer than this are considered stale. */
|
|
4
|
-
inactivityThresholdMs?: number;
|
|
5
|
-
/** Sessions started before (now - this) are skipped. */
|
|
6
|
-
maxLookbackMs?: number;
|
|
7
|
-
/** Override clock for tests. */
|
|
8
|
-
now?: number;
|
|
9
|
-
}
|
|
10
|
-
export interface ReconcileOptions extends ReconciliationOptions {
|
|
11
|
-
/** Injected for tests. Defaults to the real `processEvent` from the hook module. */
|
|
12
|
-
processEvent?: ProcessEventFn;
|
|
13
|
-
}
|
|
14
|
-
export interface StaleCodexSession {
|
|
15
|
-
sessionId: string;
|
|
16
|
-
startTime: number;
|
|
17
|
-
lastActivityMs: number;
|
|
18
|
-
}
|
|
19
|
-
interface SessionEndEventLike {
|
|
20
|
-
hook_event_name: 'SessionEnd';
|
|
21
|
-
session_id: string;
|
|
22
|
-
transcript_path: string;
|
|
23
|
-
permission_mode: string;
|
|
24
|
-
cwd: string;
|
|
25
|
-
reason: string;
|
|
26
|
-
}
|
|
27
|
-
type ProcessEventFn = (event: SessionEndEventLike, config: HookProcessingConfig) => Promise<void>;
|
|
28
|
-
/**
|
|
29
|
-
* Find codex sessions in `~/.codemie/sessions/` that look stranded.
|
|
30
|
-
*/
|
|
31
|
-
export declare function findStaleCodexSessions(opts?: ReconciliationOptions): Promise<StaleCodexSession[]>;
|
|
32
1
|
/**
|
|
33
|
-
*
|
|
2
|
+
* Codex Stale-Session Reconciliation
|
|
34
3
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
4
|
+
* Codex 0.129.0 has no graceful-shutdown guarantee, so a hard kill strands the
|
|
5
|
+
* CodeMie session record as `status: "active"` with no terminal lifecycle metric.
|
|
6
|
+
* Every codex `onSessionStart` reconciles those leftovers.
|
|
7
|
+
*
|
|
8
|
+
* The logic is agent-generic and lives in
|
|
9
|
+
* `@/agents/core/session/stale-session-reconciliation.js`; this module only binds it
|
|
10
|
+
* to the `codex` agent name.
|
|
37
11
|
*/
|
|
12
|
+
import type { HookProcessingConfig } from '../../../cli/commands/hook.js';
|
|
13
|
+
import { type ReconcileOptions, type ReconciliationOptions, type StaleSession } from '../../core/session/stale-session-reconciliation.js';
|
|
14
|
+
export type { ReconcileOptions, ReconciliationOptions };
|
|
15
|
+
export type StaleCodexSession = StaleSession;
|
|
16
|
+
/** Find codex sessions in `~/.codemie/sessions/` that look stranded. */
|
|
17
|
+
export declare function findStaleCodexSessions(opts?: ReconciliationOptions): Promise<StaleCodexSession[]>;
|
|
18
|
+
/** Synthesise a SessionEnd for each stale codex session. */
|
|
38
19
|
export declare function reconcileStaleCodexSessions(env: NodeJS.ProcessEnv, buildHookConfig: (env: NodeJS.ProcessEnv, sessionId: string) => HookProcessingConfig, opts?: ReconcileOptions): Promise<{
|
|
39
20
|
reconciled: number;
|
|
40
21
|
failed: number;
|
|
41
22
|
}>;
|
|
42
|
-
export {};
|
|
43
23
|
//# sourceMappingURL=codex.reconciliation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.reconciliation.d.ts","sourceRoot":"","sources":["../../../../src/agents/plugins/codex/codex.reconciliation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"codex.reconciliation.d.ts","sourceRoot":"","sources":["../../../../src/agents/plugins/codex/codex.reconciliation.ts"],"names":[],"mappings":"AACA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EAClB,MAAM,oDAAoD,CAAC;AAE5D,YAAY,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,CAAC;AAExD,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAE7C,wEAAwE;AACxE,wBAAgB,sBAAsB,CACpC,IAAI,GAAE,qBAA0B,GAC/B,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAE9B;AAED,4DAA4D;AAC5D,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,eAAe,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,SAAS,EAAE,MAAM,KAAK,oBAAoB,EACpF,IAAI,GAAE,gBAAqB,GAC1B,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAEjD"}
|
|
@@ -1,141 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* server-side analytics see them as never-finishing.
|
|
10
|
-
*
|
|
11
|
-
* On every codex `onSessionStart`, we scan for such stranded sessions and
|
|
12
|
-
* synthesise a SessionEnd with `reason: "interrupted"` to finalise them.
|
|
13
|
-
*
|
|
14
|
-
* Inactivity threshold defaults to 30 minutes; the lookback window is capped
|
|
15
|
-
* to 24 hours so a first deploy does not emit a burst of synthetic events for
|
|
16
|
-
* ancient stranded rollouts.
|
|
17
|
-
*/
|
|
18
|
-
import { readdir, readFile } from 'fs/promises';
|
|
19
|
-
import { existsSync } from 'fs';
|
|
20
|
-
import { basename, join } from 'path';
|
|
21
|
-
import { getCodemiePath } from '../../../utils/paths.js';
|
|
22
|
-
import { logger } from '../../../utils/logger.js';
|
|
23
|
-
const DEFAULT_INACTIVITY_THRESHOLD_MS = 30 * 60 * 1000;
|
|
24
|
-
const DEFAULT_MAX_LOOKBACK_MS = 24 * 60 * 60 * 1000;
|
|
25
|
-
/**
|
|
26
|
-
* Find codex sessions in `~/.codemie/sessions/` that look stranded.
|
|
27
|
-
*/
|
|
28
|
-
export async function findStaleCodexSessions(opts = {}) {
|
|
29
|
-
const now = opts.now ?? Date.now();
|
|
30
|
-
const inactivityThresholdMs = opts.inactivityThresholdMs ?? DEFAULT_INACTIVITY_THRESHOLD_MS;
|
|
31
|
-
const maxLookbackMs = opts.maxLookbackMs ?? DEFAULT_MAX_LOOKBACK_MS;
|
|
32
|
-
const sessionsDir = getCodemiePath('sessions');
|
|
33
|
-
if (!existsSync(sessionsDir)) {
|
|
34
|
-
return [];
|
|
35
|
-
}
|
|
36
|
-
let entries;
|
|
37
|
-
try {
|
|
38
|
-
entries = await readdir(sessionsDir);
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
logger.debug('[codex-reconciliation] Failed to read sessions dir', error);
|
|
42
|
-
return [];
|
|
43
|
-
}
|
|
44
|
-
const stale = [];
|
|
45
|
-
const cutoffActivity = now - inactivityThresholdMs;
|
|
46
|
-
const cutoffStart = now - maxLookbackMs;
|
|
47
|
-
for (const entry of entries) {
|
|
48
|
-
if (!entry.endsWith('.json'))
|
|
49
|
-
continue;
|
|
50
|
-
if (entry.startsWith('completed_'))
|
|
51
|
-
continue;
|
|
52
|
-
if (entry.includes('_metrics') || entry.includes('_conversation'))
|
|
53
|
-
continue;
|
|
54
|
-
const filePath = join(sessionsDir, entry);
|
|
55
|
-
let session;
|
|
56
|
-
try {
|
|
57
|
-
const content = await readFile(filePath, 'utf-8');
|
|
58
|
-
session = JSON.parse(content);
|
|
59
|
-
}
|
|
60
|
-
catch (error) {
|
|
61
|
-
logger.debug(`[codex-reconciliation] Skipping unreadable file ${basename(filePath)}`, error);
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
if (session.agentName !== 'codex')
|
|
65
|
-
continue;
|
|
66
|
-
if (session.status !== 'active')
|
|
67
|
-
continue;
|
|
68
|
-
if (typeof session.startTime !== 'number')
|
|
69
|
-
continue;
|
|
70
|
-
if (session.startTime < cutoffStart)
|
|
71
|
-
continue;
|
|
72
|
-
const lastActivity = computeLastActivity(session);
|
|
73
|
-
if (lastActivity > cutoffActivity)
|
|
74
|
-
continue;
|
|
75
|
-
stale.push({
|
|
76
|
-
sessionId: session.sessionId,
|
|
77
|
-
startTime: session.startTime,
|
|
78
|
-
lastActivityMs: lastActivity,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
return stale;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Synthesise a SessionEnd for each stale codex session.
|
|
85
|
-
*
|
|
86
|
-
* `processEvent` is injected so tests can drive this without touching the
|
|
87
|
-
* hook module's network and SSO-credential code paths.
|
|
88
|
-
*/
|
|
89
|
-
export async function reconcileStaleCodexSessions(env, buildHookConfig, opts = {}) {
|
|
90
|
-
const stale = await findStaleCodexSessions(opts);
|
|
91
|
-
if (stale.length === 0) {
|
|
92
|
-
return { reconciled: 0, failed: 0 };
|
|
93
|
-
}
|
|
94
|
-
logger.info(`[codex-reconciliation] Found ${stale.length} stranded codex session(s); reconciling`);
|
|
95
|
-
const processEvent = opts.processEvent ?? (await loadDefaultProcessEvent());
|
|
96
|
-
let reconciled = 0;
|
|
97
|
-
let failed = 0;
|
|
98
|
-
for (const entry of stale) {
|
|
99
|
-
try {
|
|
100
|
-
const event = {
|
|
101
|
-
hook_event_name: 'SessionEnd',
|
|
102
|
-
session_id: entry.sessionId,
|
|
103
|
-
transcript_path: '',
|
|
104
|
-
permission_mode: 'default',
|
|
105
|
-
cwd: process.cwd(),
|
|
106
|
-
reason: 'interrupted',
|
|
107
|
-
};
|
|
108
|
-
await processEvent(event, buildHookConfig(env, entry.sessionId));
|
|
109
|
-
reconciled++;
|
|
110
|
-
logger.info(`[codex-reconciliation] Reconciled stranded session ${entry.sessionId}`);
|
|
111
|
-
}
|
|
112
|
-
catch (error) {
|
|
113
|
-
failed++;
|
|
114
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
115
|
-
logger.warn(`[codex-reconciliation] Failed to reconcile ${entry.sessionId}: ${msg}`);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return { reconciled, failed };
|
|
119
|
-
}
|
|
120
|
-
function computeLastActivity(session) {
|
|
121
|
-
const candidates = [];
|
|
122
|
-
if (typeof session.startTime === 'number')
|
|
123
|
-
candidates.push(session.startTime);
|
|
124
|
-
const metrics = session.sync?.metrics;
|
|
125
|
-
if (metrics) {
|
|
126
|
-
if (typeof metrics.lastSyncAt === 'number')
|
|
127
|
-
candidates.push(metrics.lastSyncAt);
|
|
128
|
-
if (typeof metrics.lastProcessedTimestamp === 'number')
|
|
129
|
-
candidates.push(metrics.lastProcessedTimestamp);
|
|
130
|
-
}
|
|
131
|
-
const conversations = session.sync?.conversations;
|
|
132
|
-
if (conversations && typeof conversations.lastSyncAt === 'number') {
|
|
133
|
-
candidates.push(conversations.lastSyncAt);
|
|
134
|
-
}
|
|
135
|
-
return candidates.length === 0 ? 0 : Math.max(...candidates);
|
|
136
|
-
}
|
|
137
|
-
async function loadDefaultProcessEvent() {
|
|
138
|
-
const mod = await import('../../../cli/commands/hook.js');
|
|
139
|
-
return mod.processEvent;
|
|
1
|
+
import { findStaleSessions, reconcileStaleSessions, } from '../../core/session/stale-session-reconciliation.js';
|
|
2
|
+
/** Find codex sessions in `~/.codemie/sessions/` that look stranded. */
|
|
3
|
+
export function findStaleCodexSessions(opts = {}) {
|
|
4
|
+
return findStaleSessions('codex', opts);
|
|
5
|
+
}
|
|
6
|
+
/** Synthesise a SessionEnd for each stale codex session. */
|
|
7
|
+
export function reconcileStaleCodexSessions(env, buildHookConfig, opts = {}) {
|
|
8
|
+
return reconcileStaleSessions('codex', env, buildHookConfig, opts);
|
|
140
9
|
}
|
|
141
10
|
//# sourceMappingURL=codex.reconciliation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.reconciliation.js","sourceRoot":"","sources":["../../../../src/agents/plugins/codex/codex.reconciliation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"codex.reconciliation.js","sourceRoot":"","sources":["../../../../src/agents/plugins/codex/codex.reconciliation.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,iBAAiB,EACjB,sBAAsB,GAIvB,MAAM,oDAAoD,CAAC;AAM5D,wEAAwE;AACxE,MAAM,UAAU,sBAAsB,CACpC,OAA8B,EAAE;IAEhC,OAAO,iBAAiB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAC1C,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,2BAA2B,CACzC,GAAsB,EACtB,eAAoF,EACpF,OAAyB,EAAE;IAE3B,OAAO,sBAAsB,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,CAAC,CAAC;AACrE,CAAC"}
|