@rubytech/create-realagent-code 0.1.593 → 0.1.594
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/package.json +2 -2
- package/payload/platform/package.json +1 -0
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +5 -3
- package/payload/platform/plugins/admin/skills/whats-new/SKILL.md +5 -0
- package/payload/platform/plugins/cloudflare/PLUGIN.md +2 -0
- package/payload/platform/plugins/docs/references/internals.md +1 -1
- package/payload/platform/plugins/docs/references/telegram-guide.md +3 -1
- package/payload/platform/scripts/__tests__/agent-identity-reconcile.test.sh +110 -0
- package/payload/platform/scripts/__tests__/check-orphan-dist.test.sh +87 -0
- package/payload/platform/scripts/check-orphan-dist.mjs +143 -0
- package/payload/platform/scripts/lib/agent-identity-reconcile.sh +122 -0
- package/payload/platform/scripts/lib/provision-account-dir.sh +8 -26
- package/payload/platform/scripts/setup-account.sh +15 -0
- package/payload/platform/services/claude-session-manager/dist/index.js +5 -0
- package/payload/platform/services/claude-session-manager/dist/index.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.d.ts +5 -0
- package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.js +42 -1
- package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.js.map +1 -1
- package/payload/platform/templates/agents/public/IDENTITY.md +3 -3
- package/payload/platform/lib/anthropic-key/dist/index.d.ts +0 -22
- package/payload/platform/lib/anthropic-key/dist/index.d.ts.map +0 -1
- package/payload/platform/lib/anthropic-key/dist/index.js +0 -232
- package/payload/platform/lib/anthropic-key/dist/index.js.map +0 -1
- package/payload/platform/lib/graph-search/dist/query-expansion.d.ts +0 -37
- package/payload/platform/lib/graph-search/dist/query-expansion.d.ts.map +0 -1
- package/payload/platform/lib/graph-search/dist/query-expansion.js +0 -101
- package/payload/platform/lib/graph-search/dist/query-expansion.js.map +0 -1
- package/payload/platform/lib/oauth-llm/dist/index.d.ts +0 -116
- package/payload/platform/lib/oauth-llm/dist/index.d.ts.map +0 -1
- package/payload/platform/lib/oauth-llm/dist/index.js +0 -386
- package/payload/platform/lib/oauth-llm/dist/index.js.map +0 -1
- package/payload/platform/lib/screening-patterns/dist/index.d.ts +0 -29
- package/payload/platform/lib/screening-patterns/dist/index.d.ts.map +0 -1
- package/payload/platform/lib/screening-patterns/dist/index.js +0 -48
- package/payload/platform/lib/screening-patterns/dist/index.js.map +0 -1
- package/payload/platform/plugins/admin/mcp/dist/__tests__/admin-identity-authenticate.test.d.ts +0 -2
- package/payload/platform/plugins/admin/mcp/dist/__tests__/admin-identity-authenticate.test.d.ts.map +0 -1
- package/payload/platform/plugins/admin/mcp/dist/__tests__/admin-identity-authenticate.test.js +0 -34
- package/payload/platform/plugins/admin/mcp/dist/__tests__/admin-identity-authenticate.test.js.map +0 -1
- package/payload/platform/plugins/admin/mcp/dist/lib/onboarding.d.ts +0 -39
- package/payload/platform/plugins/admin/mcp/dist/lib/onboarding.d.ts.map +0 -1
- package/payload/platform/plugins/admin/mcp/dist/lib/onboarding.js +0 -249
- package/payload/platform/plugins/admin/mcp/dist/lib/onboarding.js.map +0 -1
- package/payload/platform/plugins/admin/mcp/dist/tools/admin-identity-authenticate.d.ts +0 -6
- package/payload/platform/plugins/admin/mcp/dist/tools/admin-identity-authenticate.d.ts.map +0 -1
- package/payload/platform/plugins/admin/mcp/dist/tools/admin-identity-authenticate.js +0 -32
- package/payload/platform/plugins/admin/mcp/dist/tools/admin-identity-authenticate.js.map +0 -1
- package/payload/platform/plugins/cloudflare/mcp/dist/lib/cloudflared.d.ts +0 -283
- package/payload/platform/plugins/cloudflare/mcp/dist/lib/cloudflared.d.ts.map +0 -1
- package/payload/platform/plugins/cloudflare/mcp/dist/lib/cloudflared.js +0 -1155
- package/payload/platform/plugins/cloudflare/mcp/dist/lib/cloudflared.js.map +0 -1
- package/payload/platform/plugins/cloudflare/mcp/dist/lib/setup-orchestrator.d.ts +0 -90
- package/payload/platform/plugins/cloudflare/mcp/dist/lib/setup-orchestrator.d.ts.map +0 -1
- package/payload/platform/plugins/cloudflare/mcp/dist/lib/setup-orchestrator.js +0 -551
- package/payload/platform/plugins/cloudflare/mcp/dist/lib/setup-orchestrator.js.map +0 -1
- package/payload/platform/plugins/email/mcp/dist/lib/claude-bridge.d.ts +0 -17
- package/payload/platform/plugins/email/mcp/dist/lib/claude-bridge.d.ts.map +0 -1
- package/payload/platform/plugins/email/mcp/dist/lib/claude-bridge.js +0 -186
- package/payload/platform/plugins/email/mcp/dist/lib/claude-bridge.js.map +0 -1
- package/payload/platform/plugins/email/mcp/dist/lib/screening.d.ts +0 -29
- package/payload/platform/plugins/email/mcp/dist/lib/screening.d.ts.map +0 -1
- package/payload/platform/plugins/email/mcp/dist/lib/screening.js +0 -105
- package/payload/platform/plugins/email/mcp/dist/lib/screening.js.map +0 -1
- package/payload/platform/plugins/email/mcp/dist/scripts/email-auto-respond.d.ts +0 -38
- package/payload/platform/plugins/email/mcp/dist/scripts/email-auto-respond.d.ts.map +0 -1
- package/payload/platform/plugins/email/mcp/dist/scripts/email-auto-respond.js +0 -817
- package/payload/platform/plugins/email/mcp/dist/scripts/email-auto-respond.js.map +0 -1
- package/payload/platform/plugins/email/mcp/dist/scripts/email-fetch.d.ts +0 -30
- package/payload/platform/plugins/email/mcp/dist/scripts/email-fetch.d.ts.map +0 -1
- package/payload/platform/plugins/email/mcp/dist/scripts/email-fetch.js +0 -215
- package/payload/platform/plugins/email/mcp/dist/scripts/email-fetch.js.map +0 -1
- package/payload/platform/plugins/email/mcp/dist/tools/email-auto-respond-config.d.ts +0 -19
- package/payload/platform/plugins/email/mcp/dist/tools/email-auto-respond-config.d.ts.map +0 -1
- package/payload/platform/plugins/email/mcp/dist/tools/email-auto-respond-config.js +0 -151
- package/payload/platform/plugins/email/mcp/dist/tools/email-auto-respond-config.js.map +0 -1
- package/payload/platform/plugins/email/mcp/dist/tools/email-classify.d.ts +0 -6
- package/payload/platform/plugins/email/mcp/dist/tools/email-classify.d.ts.map +0 -1
- package/payload/platform/plugins/email/mcp/dist/tools/email-classify.js +0 -89
- package/payload/platform/plugins/email/mcp/dist/tools/email-classify.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/compiled-truth-rewriter-operator-hint.test.d.ts +0 -2
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/compiled-truth-rewriter-operator-hint.test.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/compiled-truth-rewriter-operator-hint.test.js +0 -90
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/compiled-truth-rewriter-operator-hint.test.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/llm-classifier.test.d.ts +0 -2
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/llm-classifier.test.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/llm-classifier.test.js +0 -226
- package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/llm-classifier.test.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/compiled-truth-rewriter.d.ts +0 -60
- package/payload/platform/plugins/memory/mcp/dist/lib/compiled-truth-rewriter.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/compiled-truth-rewriter.js +0 -169
- package/payload/platform/plugins/memory/mcp/dist/lib/compiled-truth-rewriter.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-classifier.d.ts +0 -248
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-classifier.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-classifier.js +0 -824
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-classifier.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-ranker.d.ts +0 -63
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-ranker.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-ranker.js +0 -210
- package/payload/platform/plugins/memory/mcp/dist/lib/llm-ranker.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/typed-edge-pass.d.ts +0 -35
- package/payload/platform/plugins/memory/mcp/dist/lib/typed-edge-pass.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/lib/typed-edge-pass.js +0 -28
- package/payload/platform/plugins/memory/mcp/dist/lib/typed-edge-pass.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-derive-insights-emit.test.d.ts +0 -2
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-derive-insights-emit.test.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-derive-insights-emit.test.js +0 -68
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/conversation-archive-derive-insights-emit.test.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-archive-write-emit.test.d.ts +0 -2
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-archive-write-emit.test.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-archive-write-emit.test.js +0 -88
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-archive-write-emit.test.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-classify-emit.test.d.ts +0 -2
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-classify-emit.test.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-classify-emit.test.js +0 -58
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-classify-emit.test.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-delete-emit.test.d.ts +0 -2
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-delete-emit.test.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-delete-emit.test.js +0 -64
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-delete-emit.test.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-edit-attachment-emit.test.d.ts +0 -2
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-edit-attachment-emit.test.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-edit-attachment-emit.test.js +0 -70
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-edit-attachment-emit.test.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-empty-trash-emit.test.d.ts +0 -2
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-empty-trash-emit.test.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-empty-trash-emit.test.js +0 -48
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-empty-trash-emit.test.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-emit.test.d.ts +0 -2
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-emit.test.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-emit.test.js +0 -74
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-emit.test.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-extract-emit.test.d.ts +0 -2
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-extract-emit.test.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-extract-emit.test.js +0 -47
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-extract-emit.test.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-web-emit.test.d.ts +0 -2
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-web-emit.test.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-web-emit.test.js +0 -65
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-ingest-web-emit.test.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-reindex-emit.test.d.ts +0 -2
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-reindex-emit.test.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-reindex-emit.test.js +0 -43
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-reindex-emit.test.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-rename-attachment-emit.test.d.ts +0 -2
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-rename-attachment-emit.test.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-rename-attachment-emit.test.js +0 -65
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-rename-attachment-emit.test.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-restore-emit.test.d.ts +0 -2
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-restore-emit.test.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-restore-emit.test.js +0 -49
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-restore-emit.test.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-emit.test.d.ts +0 -2
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-emit.test.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-emit.test.js +0 -79
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-emit.test.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-operator-hint.test.d.ts +0 -2
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-operator-hint.test.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-operator-hint.test.js +0 -329
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-update-operator-hint.test.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-write-emit.test.d.ts +0 -2
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-write-emit.test.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-write-emit.test.js +0 -81
- package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-write-emit.test.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-classify.d.ts +0 -34
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-classify.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-classify.js +0 -62
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-classify.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-rank.d.ts +0 -61
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-rank.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-rank.js +0 -102
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-rank.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-signals-recent.d.ts +0 -35
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-signals-recent.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-signals-recent.js +0 -73
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-signals-recent.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-typed-edge-pass.d.ts +0 -29
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-typed-edge-pass.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-typed-edge-pass.js +0 -22
- package/payload/platform/plugins/memory/mcp/dist/tools/memory-typed-edge-pass.js.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/session-retrospective-skip-rate.d.ts +0 -30
- package/payload/platform/plugins/memory/mcp/dist/tools/session-retrospective-skip-rate.d.ts.map +0 -1
- package/payload/platform/plugins/memory/mcp/dist/tools/session-retrospective-skip-rate.js +0 -130
- package/payload/platform/plugins/memory/mcp/dist/tools/session-retrospective-skip-rate.js.map +0 -1
- package/payload/platform/plugins/outlook/mcp/dist/auth/pkce-flow.d.ts +0 -65
- package/payload/platform/plugins/outlook/mcp/dist/auth/pkce-flow.d.ts.map +0 -1
- package/payload/platform/plugins/outlook/mcp/dist/auth/pkce-flow.js +0 -262
- package/payload/platform/plugins/outlook/mcp/dist/auth/pkce-flow.js.map +0 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/normalise-start-date.test.d.ts +0 -2
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/normalise-start-date.test.d.ts.map +0 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/normalise-start-date.test.js +0 -100
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/normalise-start-date.test.js.map +0 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/scheduled-seat-id.test.d.ts +0 -2
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/scheduled-seat-id.test.d.ts.map +0 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/scheduled-seat-id.test.js +0 -22
- package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/scheduled-seat-id.test.js.map +0 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/scheduled-seat-id.d.ts +0 -11
- package/payload/platform/plugins/scheduling/mcp/dist/lib/scheduled-seat-id.d.ts.map +0 -1
- package/payload/platform/plugins/scheduling/mcp/dist/lib/scheduled-seat-id.js +0 -19
- package/payload/platform/plugins/scheduling/mcp/dist/lib/scheduled-seat-id.js.map +0 -1
- package/payload/platform/plugins/url-get/mcp/dist/lib/summarise.d.ts +0 -8
- package/payload/platform/plugins/url-get/mcp/dist/lib/summarise.d.ts.map +0 -1
- package/payload/platform/plugins/url-get/mcp/dist/lib/summarise.js +0 -83
- package/payload/platform/plugins/url-get/mcp/dist/lib/summarise.js.map +0 -1
- package/payload/platform/plugins/workflows/mcp/dist/lib/llm-call.d.ts +0 -151
- package/payload/platform/plugins/workflows/mcp/dist/lib/llm-call.d.ts.map +0 -1
- package/payload/platform/plugins/workflows/mcp/dist/lib/llm-call.js +0 -299
- package/payload/platform/plugins/workflows/mcp/dist/lib/llm-call.js.map +0 -1
- package/payload/platform/services/claude-session-manager/dist/account-admin-census.d.ts +0 -39
- package/payload/platform/services/claude-session-manager/dist/account-admin-census.d.ts.map +0 -1
- package/payload/platform/services/claude-session-manager/dist/account-admin-census.js +0 -122
- package/payload/platform/services/claude-session-manager/dist/account-admin-census.js.map +0 -1
- package/payload/platform/services/claude-session-manager/dist/admin-identity-audit.d.ts +0 -39
- package/payload/platform/services/claude-session-manager/dist/admin-identity-audit.d.ts.map +0 -1
- package/payload/platform/services/claude-session-manager/dist/admin-identity-audit.js +0 -133
- package/payload/platform/services/claude-session-manager/dist/admin-identity-audit.js.map +0 -1
- package/payload/platform/services/claude-session-manager/dist/input-postcondition.d.ts +0 -22
- package/payload/platform/services/claude-session-manager/dist/input-postcondition.d.ts.map +0 -1
- package/payload/platform/services/claude-session-manager/dist/input-postcondition.js +0 -50
- package/payload/platform/services/claude-session-manager/dist/input-postcondition.js.map +0 -1
- package/payload/platform/services/claude-session-manager/dist/jsonl-observer.d.ts +0 -30
- package/payload/platform/services/claude-session-manager/dist/jsonl-observer.d.ts.map +0 -1
- package/payload/platform/services/claude-session-manager/dist/jsonl-observer.js +0 -204
- package/payload/platform/services/claude-session-manager/dist/jsonl-observer.js.map +0 -1
- package/payload/platform/services/claude-session-manager/dist/rc-script-spawn.d.ts +0 -80
- package/payload/platform/services/claude-session-manager/dist/rc-script-spawn.d.ts.map +0 -1
- package/payload/platform/services/claude-session-manager/dist/rc-script-spawn.js +0 -306
- package/payload/platform/services/claude-session-manager/dist/rc-script-spawn.js.map +0 -1
- package/payload/platform/services/claude-session-manager/dist/session-store.d.ts +0 -49
- package/payload/platform/services/claude-session-manager/dist/session-store.d.ts.map +0 -1
- package/payload/platform/services/claude-session-manager/dist/session-store.js +0 -52
- package/payload/platform/services/claude-session-manager/dist/session-store.js.map +0 -1
- package/payload/platform/services/claude-session-manager/dist/systemd-spawn.d.ts +0 -83
- package/payload/platform/services/claude-session-manager/dist/systemd-spawn.d.ts.map +0 -1
- package/payload/platform/services/claude-session-manager/dist/systemd-spawn.js +0 -345
- package/payload/platform/services/claude-session-manager/dist/systemd-spawn.js.map +0 -1
- package/payload/platform/services/telegram-channel/dist/turn-follow.d.ts +0 -104
- package/payload/platform/services/telegram-channel/dist/turn-follow.d.ts.map +0 -1
- package/payload/platform/services/telegram-channel/dist/turn-follow.js +0 -408
- package/payload/platform/services/telegram-channel/dist/turn-follow.js.map +0 -1
- package/payload/platform/services/whatsapp-channel/dist/turn-follow.d.ts +0 -104
- package/payload/platform/services/whatsapp-channel/dist/turn-follow.d.ts.map +0 -1
- package/payload/platform/services/whatsapp-channel/dist/turn-follow.js +0 -393
- package/payload/platform/services/whatsapp-channel/dist/turn-follow.js.map +0 -1
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
// Task 1500 — standing account-admin census. Every client sub-account must
|
|
2
|
-
// carry a `managingAdminUserId` pointing at a live house admin (account_create
|
|
3
|
-
// enforces this going forward). Two states break silently and emit no event:
|
|
4
|
-
// - `absent`: an account created before this change has no managingAdminUserId.
|
|
5
|
-
// - `dangling`: the managing admin was removed from the house admins[] after
|
|
6
|
-
// assignment, so the pointer names a userId no live house admin holds.
|
|
7
|
-
// Neither reproduces on demand, so an independent periodic reconcile is the only
|
|
8
|
-
// signal. This census is filesystem-only (account.json vs the house admins[]);
|
|
9
|
-
// the unassigned-:Task symptom is covered by work-create's op=assign line and
|
|
10
|
-
// the 1488 audit-gap, not here. Shape mirrors rootless-client-audit.ts: a pure
|
|
11
|
-
// reconcile (unit-tested) + an impure collector + an unref'd start/stop factory.
|
|
12
|
-
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
13
|
-
import { join } from 'node:path';
|
|
14
|
-
const TAG = '[account-admin-census]';
|
|
15
|
-
/** Pure reconcile: classify each client account against the live house admin
|
|
16
|
-
* set. A row with no managingAdminUserId is `absent`; a row whose id is not in
|
|
17
|
-
* `liveHouseAdminUserIds` is `dangling`; otherwise `assigned`. Deterministic
|
|
18
|
-
* and IO-free so the boundaries are unit-testable. */
|
|
19
|
-
export function reconcileAccountAdminCensus(clients, liveHouseAdminUserIds) {
|
|
20
|
-
const live = new Set(liveHouseAdminUserIds);
|
|
21
|
-
const absentIds = [];
|
|
22
|
-
const danglingIds = [];
|
|
23
|
-
let assigned = 0;
|
|
24
|
-
for (const c of clients) {
|
|
25
|
-
const id = c.managingAdminUserId;
|
|
26
|
-
if (!id)
|
|
27
|
-
absentIds.push(c.accountId);
|
|
28
|
-
else if (!live.has(id))
|
|
29
|
-
danglingIds.push(c.accountId);
|
|
30
|
-
else
|
|
31
|
-
assigned++;
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
total: clients.length,
|
|
35
|
-
assigned,
|
|
36
|
-
absent: absentIds.length,
|
|
37
|
-
dangling: danglingIds.length,
|
|
38
|
-
absentIds,
|
|
39
|
-
danglingIds,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
/** The census line. Offender ids are logged in full (not truncated) so each
|
|
43
|
-
* correlates directly with an account dir; `-` marks an empty list so every
|
|
44
|
-
* field is present and greppable. Healthy: `absent=0 dangling=0`. */
|
|
45
|
-
export function formatCensusLine(c) {
|
|
46
|
-
const absent = c.absentIds.length ? c.absentIds.join(',') : '-';
|
|
47
|
-
const dangling = c.danglingIds.length ? c.danglingIds.join(',') : '-';
|
|
48
|
-
return `${TAG} total=${c.total} assigned=${c.assigned} absent=${c.absent} dangling=${c.dangling} absent-ids=${absent} dangling-ids=${dangling}`;
|
|
49
|
-
}
|
|
50
|
-
/** Read every registered account.json under the accounts root. An unparseable
|
|
51
|
-
* account.json is excluded (corruption discipline, mirrors the lifecycle
|
|
52
|
-
* enumerator). */
|
|
53
|
-
function readAccounts(accountsRoot) {
|
|
54
|
-
let entries;
|
|
55
|
-
try {
|
|
56
|
-
entries = readdirSync(accountsRoot);
|
|
57
|
-
}
|
|
58
|
-
catch {
|
|
59
|
-
return [];
|
|
60
|
-
}
|
|
61
|
-
const out = [];
|
|
62
|
-
for (const entry of entries) {
|
|
63
|
-
const cfgPath = join(accountsRoot, entry, 'account.json');
|
|
64
|
-
if (!existsSync(cfgPath))
|
|
65
|
-
continue;
|
|
66
|
-
try {
|
|
67
|
-
const cfg = JSON.parse(readFileSync(cfgPath, 'utf-8'));
|
|
68
|
-
const admins = Array.isArray(cfg.admins)
|
|
69
|
-
? cfg.admins
|
|
70
|
-
.map((a) => a && typeof a === 'object' && typeof a.userId === 'string'
|
|
71
|
-
? a.userId
|
|
72
|
-
: null)
|
|
73
|
-
.filter((u) => u !== null && u.length > 0)
|
|
74
|
-
: [];
|
|
75
|
-
out.push({
|
|
76
|
-
accountId: entry,
|
|
77
|
-
role: typeof cfg.role === 'string' ? cfg.role : '',
|
|
78
|
-
managingAdminUserId: typeof cfg.managingAdminUserId === 'string' && cfg.managingAdminUserId
|
|
79
|
-
? cfg.managingAdminUserId
|
|
80
|
-
: undefined,
|
|
81
|
-
admins,
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
catch {
|
|
85
|
-
// unparseable account.json — excluded
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return out;
|
|
89
|
-
}
|
|
90
|
-
/** Run one census pass and log a single line. Filesystem-only and best-effort:
|
|
91
|
-
* an unreadable accounts root yields `total=0` rather than throwing. */
|
|
92
|
-
export function emitAccountAdminCensus(deps) {
|
|
93
|
-
const accounts = readAccounts(deps.accountsRoot);
|
|
94
|
-
const liveHouseAdminUserIds = accounts.filter((a) => a.role === 'house').flatMap((a) => a.admins);
|
|
95
|
-
const clients = accounts
|
|
96
|
-
.filter((a) => a.role === 'client')
|
|
97
|
-
.map((a) => ({ accountId: a.accountId, managingAdminUserId: a.managingAdminUserId }));
|
|
98
|
-
deps.logger(formatCensusLine(reconcileAccountAdminCensus(clients, liveHouseAdminUserIds)));
|
|
99
|
-
}
|
|
100
|
-
/** Standing periodic census. Unref'd interval so it never holds the process
|
|
101
|
-
* open; each tick re-emits best-effort. */
|
|
102
|
-
export function createAccountAdminCensus(deps) {
|
|
103
|
-
let timer = null;
|
|
104
|
-
return {
|
|
105
|
-
start() {
|
|
106
|
-
if (timer)
|
|
107
|
-
return;
|
|
108
|
-
timer = setInterval(() => {
|
|
109
|
-
emitAccountAdminCensus(deps);
|
|
110
|
-
}, deps.intervalMs);
|
|
111
|
-
if (typeof timer.unref === 'function')
|
|
112
|
-
timer.unref();
|
|
113
|
-
},
|
|
114
|
-
stop() {
|
|
115
|
-
if (timer) {
|
|
116
|
-
clearInterval(timer);
|
|
117
|
-
timer = null;
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
//# sourceMappingURL=account-admin-census.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"account-admin-census.js","sourceRoot":"","sources":["../src/account-admin-census.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,+EAA+E;AAC/E,6EAA6E;AAC7E,kFAAkF;AAClF,+EAA+E;AAC/E,2EAA2E;AAC3E,iFAAiF;AACjF,+EAA+E;AAC/E,8EAA8E;AAC9E,+EAA+E;AAC/E,iFAAiF;AAEjF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,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,IAAI,CAAC,CAAA;YAC9B,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;YACnB,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,UAAU;gBAAE,KAAK,CAAC,KAAK,EAAE,CAAA;QACtD,CAAC;QACD,IAAI;YACF,IAAI,KAAK,EAAE,CAAC;gBACV,aAAa,CAAC,KAAK,CAAC,CAAA;gBACpB,KAAK,GAAG,IAAI,CAAA;YACd,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { FsWatcher } from './fs-watcher.js';
|
|
2
|
-
export type Logger = (line: string) => void;
|
|
3
|
-
export interface AuditSession {
|
|
4
|
-
sessionId: string;
|
|
5
|
-
/** Sidecar role, or null for native rc-daemon operator sessions. */
|
|
6
|
-
role: string | null;
|
|
7
|
-
state: string;
|
|
8
|
-
/** True when the JSONL contains an assistant tool_use whose name is not the
|
|
9
|
-
* auth tool. */
|
|
10
|
-
usedRealTool: boolean;
|
|
11
|
-
}
|
|
12
|
-
export interface AuditOnceDeps {
|
|
13
|
-
sessions: AuditSession[];
|
|
14
|
-
hasState: (sessionId: string) => boolean;
|
|
15
|
-
logger: Logger;
|
|
16
|
-
}
|
|
17
|
-
/** Pure reconciliation: emit one audit-orphan line per live native-operator
|
|
18
|
-
* session that used a real tool but has no auth-state file. */
|
|
19
|
-
export declare function auditOnce(deps: AuditOnceDeps): number;
|
|
20
|
-
export interface IdentityAuditDeps {
|
|
21
|
-
watcher: FsWatcher;
|
|
22
|
-
/** Account dir (the manager's spawnCwd); used to derive JSONL + state paths. */
|
|
23
|
-
spawnCwd: string;
|
|
24
|
-
/** Directory holding per-session auth-state files written by the gate hook. */
|
|
25
|
-
stateDir: string;
|
|
26
|
-
intervalMs: number;
|
|
27
|
-
logger: Logger;
|
|
28
|
-
}
|
|
29
|
-
export interface IdentityAudit {
|
|
30
|
-
start(): void;
|
|
31
|
-
stop(): void;
|
|
32
|
-
/** Run one audit pass synchronously. Exposed for tests. */
|
|
33
|
-
tickOnce(): {
|
|
34
|
-
scanned: number;
|
|
35
|
-
orphans: number;
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
export declare function createIdentityAudit(deps: IdentityAuditDeps): IdentityAudit;
|
|
39
|
-
//# sourceMappingURL=admin-identity-audit.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"admin-identity-audit.d.ts","sourceRoot":"","sources":["../src/admin-identity-audit.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,iBAAiB,CAAA;AAU5D,MAAM,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;AAE3C,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,oEAAoE;IACpE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb;qBACiB;IACjB,YAAY,EAAE,OAAO,CAAA;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,YAAY,EAAE,CAAA;IACxB,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAA;IACxC,MAAM,EAAE,MAAM,CAAA;CACf;AAED;gEACgE;AAChE,wBAAgB,SAAS,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAarD;AAiCD,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,SAAS,CAAA;IAClB,gFAAgF;IAChF,QAAQ,EAAE,MAAM,CAAA;IAChB,+EAA+E;IAC/E,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,IAAI,IAAI,CAAA;IACb,IAAI,IAAI,IAAI,CAAA;IACZ,2DAA2D;IAC3D,QAAQ,IAAI;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;CACjD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,aAAa,CA0C1E"}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
// Standing audit for the native-CC admin PIN identity gate (Task 619).
|
|
2
|
-
//
|
|
3
|
-
// The no-event-failure detector. The gate hook, the validate endpoint, and the
|
|
4
|
-
// auth tool each emit a log line WHEN they run — but a silent bypass (the gate
|
|
5
|
-
// hook not wired into a session's settings, or a regression that strips it)
|
|
6
|
-
// produces no log line at all. This audit reconciles, independently of the hook,
|
|
7
|
-
// the set of live native-operator sessions that reached real tool use against the
|
|
8
|
-
// set that completed PIN auth (one auth-state file per authenticated session_id).
|
|
9
|
-
// Any live native-operator session that used a real tool with no auth-state file
|
|
10
|
-
// is an orphan: the gate did not bind an identity, yet the session acted.
|
|
11
|
-
//
|
|
12
|
-
// Native-operator classification: a live watcher row whose `role` is null. Native
|
|
13
|
-
// `claude rc` operator sessions are spawned by the rc-daemon, not via the
|
|
14
|
-
// manager's /spawn path, so they carry no sidecar and `role` resolves to null.
|
|
15
|
-
// pty-spawned sessions (recorder, specialists, public, WhatsApp/Telegram)
|
|
16
|
-
// normally carry a sidecar with a non-null role and are excluded. The narrow
|
|
17
|
-
// exception is a pty spawn whose sidecar is briefly absent or unreadable
|
|
18
|
-
// (`applySidecarToRow` defaults role to null) AND has already produced a real
|
|
19
|
-
// tool_use — that would be flagged spuriously. This only ever ADDS an orphan
|
|
20
|
-
// signal (false positive), never hides a real bypass, so the audit errs safe.
|
|
21
|
-
//
|
|
22
|
-
// "Real tool" excludes admin-identity-authenticate itself: a session that only
|
|
23
|
-
// ever called the auth tool either matched (state file written) or missed
|
|
24
|
-
// (terminated), so it never reaches this branch.
|
|
25
|
-
import { existsSync, readFileSync, statSync } from 'node:fs';
|
|
26
|
-
import { join } from 'node:path';
|
|
27
|
-
import { jsonlPathForSessionId } from './jsonl-path.js';
|
|
28
|
-
const TAG = '[admin-identity]';
|
|
29
|
-
const AUTH_TOOL = 'admin-identity-authenticate';
|
|
30
|
-
/** Skip JSONLs larger than this in the tool-use scan — a bounded read keeps the
|
|
31
|
-
* per-tick cost predictable. A session this large has unquestionably used real
|
|
32
|
-
* tools, so treat an oversized file as "used a real tool" (conservative: it can
|
|
33
|
-
* only ever ADD an orphan signal, never hide one). */
|
|
34
|
-
const MAX_SCAN_BYTES = 8 * 1024 * 1024;
|
|
35
|
-
/** Pure reconciliation: emit one audit-orphan line per live native-operator
|
|
36
|
-
* session that used a real tool but has no auth-state file. */
|
|
37
|
-
export function auditOnce(deps) {
|
|
38
|
-
let orphans = 0;
|
|
39
|
-
for (const s of deps.sessions) {
|
|
40
|
-
if (s.state !== 'live')
|
|
41
|
-
continue;
|
|
42
|
-
if (s.role !== null)
|
|
43
|
-
continue; // pty-spawned (sidecar present) — not a native operator
|
|
44
|
-
if (!s.usedRealTool)
|
|
45
|
-
continue; // pre-tool-use session — gate has not been exercised yet
|
|
46
|
-
if (deps.hasState(s.sessionId))
|
|
47
|
-
continue; // authenticated — the gate bound an identity
|
|
48
|
-
deps.logger(`${TAG} op=audit-orphan sessionId=${s.sessionId.slice(0, 8)} reason=loopback-session-without-authenticated-userId`);
|
|
49
|
-
orphans++;
|
|
50
|
-
}
|
|
51
|
-
return orphans;
|
|
52
|
-
}
|
|
53
|
-
/** True when the session JSONL contains an assistant tool_use whose name is not
|
|
54
|
-
* the auth tool. Best-effort: unreadable / unparseable lines are skipped. */
|
|
55
|
-
function jsonlUsedRealTool(jsonlPath) {
|
|
56
|
-
if (!existsSync(jsonlPath))
|
|
57
|
-
return false;
|
|
58
|
-
let raw;
|
|
59
|
-
try {
|
|
60
|
-
if (statSync(jsonlPath).size > MAX_SCAN_BYTES)
|
|
61
|
-
return true;
|
|
62
|
-
raw = readFileSync(jsonlPath, 'utf8');
|
|
63
|
-
}
|
|
64
|
-
catch {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
for (const line of raw.split('\n')) {
|
|
68
|
-
if (!line.includes('"tool_use"'))
|
|
69
|
-
continue;
|
|
70
|
-
let obj;
|
|
71
|
-
try {
|
|
72
|
-
obj = JSON.parse(line);
|
|
73
|
-
}
|
|
74
|
-
catch {
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
|
-
const content = obj?.message?.content;
|
|
78
|
-
if (!Array.isArray(content))
|
|
79
|
-
continue;
|
|
80
|
-
for (const block of content) {
|
|
81
|
-
const b = block;
|
|
82
|
-
if (b?.type === 'tool_use' && typeof b.name === 'string' && !b.name.endsWith(AUTH_TOOL)) {
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
export function createIdentityAudit(deps) {
|
|
90
|
-
let timer = null;
|
|
91
|
-
function tickOnce() {
|
|
92
|
-
const rows = deps.watcher.all();
|
|
93
|
-
const candidates = rows.filter((r) => r.state === 'live' && r.role === null);
|
|
94
|
-
const sessions = candidates.map((r) => ({
|
|
95
|
-
sessionId: r.sessionId,
|
|
96
|
-
role: r.role,
|
|
97
|
-
state: r.state,
|
|
98
|
-
usedRealTool: jsonlUsedRealTool(jsonlPathForSessionId(deps.spawnCwd, r.sessionId)),
|
|
99
|
-
}));
|
|
100
|
-
const orphans = auditOnce({
|
|
101
|
-
sessions,
|
|
102
|
-
hasState: (sid) => existsSync(join(deps.stateDir, `${sid}.json`)),
|
|
103
|
-
logger: deps.logger,
|
|
104
|
-
});
|
|
105
|
-
return { scanned: candidates.length, orphans };
|
|
106
|
-
}
|
|
107
|
-
return {
|
|
108
|
-
tickOnce,
|
|
109
|
-
start() {
|
|
110
|
-
if (timer)
|
|
111
|
-
return;
|
|
112
|
-
timer = setInterval(() => {
|
|
113
|
-
try {
|
|
114
|
-
tickOnce();
|
|
115
|
-
}
|
|
116
|
-
catch (err) {
|
|
117
|
-
deps.logger(`${TAG} op=audit-tick-failed message=${err instanceof Error ? err.message : String(err)}`);
|
|
118
|
-
}
|
|
119
|
-
}, deps.intervalMs);
|
|
120
|
-
// Don't keep the event loop alive for the audit alone.
|
|
121
|
-
if (typeof timer.unref === 'function')
|
|
122
|
-
timer.unref();
|
|
123
|
-
deps.logger(`${TAG} op=audit-started intervalMs=${deps.intervalMs} stateDir=${deps.stateDir}`);
|
|
124
|
-
},
|
|
125
|
-
stop() {
|
|
126
|
-
if (timer) {
|
|
127
|
-
clearInterval(timer);
|
|
128
|
-
timer = null;
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
//# sourceMappingURL=admin-identity-audit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"admin-identity-audit.js","sourceRoot":"","sources":["../src/admin-identity-audit.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,EAAE;AACF,+EAA+E;AAC/E,+EAA+E;AAC/E,4EAA4E;AAC5E,iFAAiF;AACjF,kFAAkF;AAClF,kFAAkF;AAClF,iFAAiF;AACjF,0EAA0E;AAC1E,EAAE;AACF,kFAAkF;AAClF,0EAA0E;AAC1E,+EAA+E;AAC/E,0EAA0E;AAC1E,6EAA6E;AAC7E,yEAAyE;AACzE,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAC9E,EAAE;AACF,+EAA+E;AAC/E,0EAA0E;AAC1E,iDAAiD;AAEjD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAGvD,MAAM,GAAG,GAAG,kBAAkB,CAAA;AAC9B,MAAM,SAAS,GAAG,6BAA6B,CAAA;AAC/C;;;uDAGuD;AACvD,MAAM,cAAc,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAA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,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC;YACjE,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC,CAAA;QACF,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,CAAA;IAChD,CAAC;IAED,OAAO;QACL,QAAQ;QACR,KAAK;YACH,IAAI,KAAK;gBAAE,OAAM;YACjB,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE;gBACvB,IAAI,CAAC;oBACH,QAAQ,EAAE,CAAA;gBACZ,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,iCAAiC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;gBACxG,CAAC;YACH,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;YACnB,uDAAuD;YACvD,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,UAAU;gBAAE,KAAK,CAAC,KAAK,EAAE,CAAA;YACpD,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,gCAAgC,IAAI,CAAC,UAAU,aAAa,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAA;QAChG,CAAC;QACD,IAAI;YACF,IAAI,KAAK,EAAE,CAAC;gBACV,aAAa,CAAC,KAAK,CAAC,CAAA;gBACpB,KAAK,GAAG,IAAI,CAAA;YACd,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export type PtyStatus = string | null;
|
|
2
|
-
export interface PostconditionDeps {
|
|
3
|
-
getPtyStatus: () => PtyStatus;
|
|
4
|
-
getUserEntryCount: () => number;
|
|
5
|
-
getLastEntryAgeMs: () => number | null;
|
|
6
|
-
now: () => number;
|
|
7
|
-
sleep: (ms: number) => Promise<void>;
|
|
8
|
-
log: (line: string) => void;
|
|
9
|
-
windowMs: number;
|
|
10
|
-
intervalMs: number;
|
|
11
|
-
}
|
|
12
|
-
/** Count `"type":"user"` records in a JSONL file. Best-effort: a missing or
|
|
13
|
-
* unreadable file is 0 (a cold spawn has no JSONL yet). */
|
|
14
|
-
export declare function countUserEntries(jsonlPath: string): number;
|
|
15
|
-
export declare function watchInputSubmission(args: {
|
|
16
|
-
pid: number | null;
|
|
17
|
-
sessionId: string;
|
|
18
|
-
bytes: number;
|
|
19
|
-
baselineUserCount: number;
|
|
20
|
-
deps: PostconditionDeps;
|
|
21
|
-
}): Promise<'submitted' | 'no-turn'>;
|
|
22
|
-
//# sourceMappingURL=input-postcondition.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input-postcondition.d.ts","sourceRoot":"","sources":["../src/input-postcondition.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,IAAI,CAAA;AAErC,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,SAAS,CAAA;IAC7B,iBAAiB,EAAE,MAAM,MAAM,CAAA;IAC/B,iBAAiB,EAAE,MAAM,MAAM,GAAG,IAAI,CAAA;IACtC,GAAG,EAAE,MAAM,MAAM,CAAA;IACjB,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACpC,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;4DAC4D;AAC5D,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAiB1D;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,iBAAiB,EAAE,MAAM,CAAA;IACzB,IAAI,EAAE,iBAAiB,CAAA;CACxB,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAkBnC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// Task 666 — the /input handler returns 200 the moment the PTY write is
|
|
2
|
-
// accepted, but a 200 does not mean a turn submitted. Poll a bounded window for
|
|
3
|
-
// the post-condition: the PTY flips to `busy`, OR a new user-message JSONL entry
|
|
4
|
-
// appears. On success emit `op=input-submitted … ackMs`; on window-elapse emit
|
|
5
|
-
// `op=input-no-turn …` naming ptyStatus + lastJsonlEntryAgeMs so a reader can
|
|
6
|
-
// tell the typed input never became a prompt without waiting for the 300s
|
|
7
|
-
// turn-timeout. Fired non-awaited by the handler; never blocks the response.
|
|
8
|
-
import { readFileSync } from 'node:fs';
|
|
9
|
-
/** Count `"type":"user"` records in a JSONL file. Best-effort: a missing or
|
|
10
|
-
* unreadable file is 0 (a cold spawn has no JSONL yet). */
|
|
11
|
-
export function countUserEntries(jsonlPath) {
|
|
12
|
-
let raw;
|
|
13
|
-
try {
|
|
14
|
-
raw = readFileSync(jsonlPath, 'utf8');
|
|
15
|
-
}
|
|
16
|
-
catch {
|
|
17
|
-
return 0;
|
|
18
|
-
}
|
|
19
|
-
let n = 0;
|
|
20
|
-
for (const line of raw.split('\n')) {
|
|
21
|
-
if (!line)
|
|
22
|
-
continue;
|
|
23
|
-
try {
|
|
24
|
-
if (JSON.parse(line).type === 'user')
|
|
25
|
-
n++;
|
|
26
|
-
}
|
|
27
|
-
catch {
|
|
28
|
-
/* partial / non-JSON tail line — skip */
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return n;
|
|
32
|
-
}
|
|
33
|
-
export async function watchInputSubmission(args) {
|
|
34
|
-
const { pid, sessionId, bytes, baselineUserCount, deps } = args;
|
|
35
|
-
const sid = sessionId.slice(0, 8);
|
|
36
|
-
const pidField = pid === null ? 'unknown' : String(pid);
|
|
37
|
-
const start = deps.now();
|
|
38
|
-
for (;;) {
|
|
39
|
-
if (deps.getPtyStatus() === 'busy' || deps.getUserEntryCount() > baselineUserCount) {
|
|
40
|
-
deps.log(`op=input-submitted pid=${pidField} sessionId=${sid} bytes=${bytes} ackMs=${deps.now() - start}`);
|
|
41
|
-
return 'submitted';
|
|
42
|
-
}
|
|
43
|
-
if (deps.now() - start >= deps.windowMs) {
|
|
44
|
-
deps.log(`op=input-no-turn pid=${pidField} sessionId=${sid} bytes=${bytes} afterMs=${deps.now() - start} ptyStatus=${deps.getPtyStatus() ?? 'none'} lastJsonlEntryAgeMs=${deps.getLastEntryAgeMs() ?? 'none'}`);
|
|
45
|
-
return 'no-turn';
|
|
46
|
-
}
|
|
47
|
-
await deps.sleep(deps.intervalMs);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=input-postcondition.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input-postcondition.js","sourceRoot":"","sources":["../src/input-postcondition.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,gFAAgF;AAChF,iFAAiF;AACjF,+EAA+E;AAC/E,8EAA8E;AAC9E,0EAA0E;AAC1E,6EAA6E;AAE7E,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAkBtC;4DAC4D;AAC5D,MAAM,UAAU,gBAAgB,CAAC,SAAiB;IAChD,IAAI,GAAW,CAAA;IACf,IAAI,CAAC;QACH,GAAG,GAAG,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,CAAA;IACV,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACnC,IAAI,CAAC,IAAI;YAAE,SA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A;QAClB,CAAC;QACD,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;IACnC,CAAC;AACH,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Logger } from './types.js';
|
|
2
|
-
export interface ObservedJsonl {
|
|
3
|
-
/** Absolute path of the JSONL file Claude Code wrote. */
|
|
4
|
-
jsonlPath: string;
|
|
5
|
-
/** Intrinsic session id (the JSONL basename, no `.jsonl` extension). */
|
|
6
|
-
claudeSessionId: string;
|
|
7
|
-
}
|
|
8
|
-
export interface ObservationHandle {
|
|
9
|
-
/** Resolves with the observed file once the head bytes match the bridge
|
|
10
|
-
* suffix. Resolves with `null` after `cancel()` is called and no match
|
|
11
|
-
* ever fired. Never rejects — observation failures are logged and the
|
|
12
|
-
* pending registration is left in place until cancel. */
|
|
13
|
-
promise: Promise<ObservedJsonl | null>;
|
|
14
|
-
/** Removes the pending observation. If a match fires after cancel, the
|
|
15
|
-
* resolve is a no-op. Safe to call multiple times. */
|
|
16
|
-
cancel: () => void;
|
|
17
|
-
}
|
|
18
|
-
export interface JsonlObserver {
|
|
19
|
-
/** Register a pending observation. Returns immediately. */
|
|
20
|
-
observe(opts: {
|
|
21
|
-
bridgeSuffix: string;
|
|
22
|
-
}): ObservationHandle;
|
|
23
|
-
/** Stop the underlying fs.watch. Tests use this for cleanup. */
|
|
24
|
-
close(): void;
|
|
25
|
-
}
|
|
26
|
-
export declare function createJsonlObserver(opts: {
|
|
27
|
-
projectsDir: string;
|
|
28
|
-
logger: Logger;
|
|
29
|
-
}): JsonlObserver;
|
|
30
|
-
//# sourceMappingURL=jsonl-observer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonl-observer.d.ts","sourceRoot":"","sources":["../src/jsonl-observer.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExC,MAAM,WAAW,aAAa;IAC5B,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAA;IACjB,wEAAwE;IACxE,eAAe,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC;;;8DAG0D;IAC1D,OAAO,EAAE,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAA;IACtC;2DACuD;IACvD,MAAM,EAAE,MAAM,IAAI,CAAA;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,2DAA2D;IAC3D,OAAO,CAAC,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,iBAAiB,CAAA;IAC1D,gEAAgE;IAChE,KAAK,IAAI,IAAI,CAAA;CACd;AAoFD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IACxC,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;CACf,GAAG,aAAa,CAgHhB"}
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
// Observe (do not predict) the JSONL file Claude Code writes for a session.
|
|
2
|
-
//
|
|
3
|
-
// the manager used to derive `jsonlPath` from the captured
|
|
4
|
-
// `/remote-control` URL at spawn time. That id is the *bridge* sessionId
|
|
5
|
-
// (the suffix after `session_` in the URL), which is NOT the same as the
|
|
6
|
-
// *intrinsic* sessionId that Claude Code uses for the JSONL filename.
|
|
7
|
-
// `GET /list` then merged the live store (keyed by bridge id) with the
|
|
8
|
-
// on-disk enumerator (keyed by intrinsic id) and the dedup never matched,
|
|
9
|
-
// producing one phantom row per spawn.
|
|
10
|
-
//
|
|
11
|
-
// The fix: never predict. Watch the project dir; when a new JSONL appears,
|
|
12
|
-
// read its head bytes and bind it to the spawn whose URL bridge-suffix
|
|
13
|
-
// appears verbatim somewhere in those bytes. Claude Code writes a
|
|
14
|
-
// `bridgeSessionId=cse_<suffix>` record in the JSONL head; the suffix is
|
|
15
|
-
// also the part after `session_` in the URL we captured. Substring match
|
|
16
|
-
// over the head bytes is the deterministic link, schema-agnostic and
|
|
17
|
-
// concurrency-safe — two spawns never share a random URL suffix.
|
|
18
|
-
//
|
|
19
|
-
// One shared `fs.watch` on the project dir. Each spawn calls `observe()`
|
|
20
|
-
// to register a pending observation; the call does a one-shot scan first
|
|
21
|
-
// (closes the snapshot-vs-watch race) and otherwise resolves on the next
|
|
22
|
-
// `rename`/`change` event whose head bytes match. PTY exit before the
|
|
23
|
-
// JSONL appears calls `cancel()` to drop the pending registration.
|
|
24
|
-
import { existsSync, mkdirSync, openSync, closeSync, readSync, readdirSync, statSync, watch } from 'node:fs';
|
|
25
|
-
import { join } from 'node:path';
|
|
26
|
-
const HEAD_READ_BYTES = 4 * 1024;
|
|
27
|
-
// Cap on the head-preview substring rendered in `*-no-match` log lines so
|
|
28
|
-
// a 4 KiB head doesn't spam a multi-line log row. 200 chars is the first
|
|
29
|
-
// line or two of a JSONL plus enough of the next record to spot a wrong
|
|
30
|
-
// bridge suffix at a glance.
|
|
31
|
-
const HEAD_PREVIEW_CHARS = 200;
|
|
32
|
-
/** Read the first HEAD_READ_BYTES of a file. Returns empty string on any
|
|
33
|
-
* IO error (ENOENT, EACCES, file truncated mid-read). The caller treats
|
|
34
|
-
* empty as "no match yet" and keeps the pending observation registered
|
|
35
|
-
* so a subsequent `change` event re-reads after Claude finishes writing. */
|
|
36
|
-
function readHead(path, logger) {
|
|
37
|
-
let fd = null;
|
|
38
|
-
try {
|
|
39
|
-
fd = openSync(path, 'r');
|
|
40
|
-
const stat = statSync(path);
|
|
41
|
-
const want = Math.min(stat.size, HEAD_READ_BYTES);
|
|
42
|
-
if (want === 0)
|
|
43
|
-
return '';
|
|
44
|
-
const buf = Buffer.alloc(want);
|
|
45
|
-
const got = readSync(fd, buf, 0, want, 0);
|
|
46
|
-
return buf.toString('utf8', 0, got);
|
|
47
|
-
}
|
|
48
|
-
catch (err) {
|
|
49
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
50
|
-
logger(`jsonl-observer head-read-failed path=${path} message=${msg}`);
|
|
51
|
-
return '';
|
|
52
|
-
}
|
|
53
|
-
finally {
|
|
54
|
-
if (fd !== null) {
|
|
55
|
-
try {
|
|
56
|
-
closeSync(fd);
|
|
57
|
-
}
|
|
58
|
-
catch { /* ignore */ }
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
/** Try to bind the given JSONL to any pending observation. Returns the
|
|
63
|
-
* observation that matched (already resolved) and the bytes read. */
|
|
64
|
-
function tryBindFile(jsonlPath, pendings, logger) {
|
|
65
|
-
if (pendings.size === 0)
|
|
66
|
-
return { bound: null, head: '' };
|
|
67
|
-
const head = readHead(jsonlPath, logger);
|
|
68
|
-
if (!head)
|
|
69
|
-
return { bound: null, head: '' };
|
|
70
|
-
for (const p of pendings) {
|
|
71
|
-
if (p.settled)
|
|
72
|
-
continue;
|
|
73
|
-
if (head.includes(p.bridgeSuffix)) {
|
|
74
|
-
const claudeSessionId = jsonlPath.endsWith('.jsonl')
|
|
75
|
-
? jsonlPath.slice(jsonlPath.lastIndexOf('/') + 1, -'.jsonl'.length)
|
|
76
|
-
: jsonlPath.slice(jsonlPath.lastIndexOf('/') + 1);
|
|
77
|
-
p.settled = true;
|
|
78
|
-
p.resolve({ jsonlPath, claudeSessionId });
|
|
79
|
-
pendings.delete(p);
|
|
80
|
-
return { bound: p, head };
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return { bound: null, head };
|
|
84
|
-
}
|
|
85
|
-
/** Build the head-preview field used in `*-no-match` log lines: cap at
|
|
86
|
-
* HEAD_PREVIEW_CHARS, replace control chars so a single log line stays
|
|
87
|
-
* one line, and JSON-quote so grep on `head-preview="…"` is reliable. */
|
|
88
|
-
function formatHeadPreview(head) {
|
|
89
|
-
const slice = head.length > HEAD_PREVIEW_CHARS ? head.slice(0, HEAD_PREVIEW_CHARS) : head;
|
|
90
|
-
return JSON.stringify(slice.replace(/[\x00-\x1f]/g, '.'));
|
|
91
|
-
}
|
|
92
|
-
export function createJsonlObserver(opts) {
|
|
93
|
-
const { projectsDir, logger } = opts;
|
|
94
|
-
// Claude Code only creates this dir on its first spawn; the manager may
|
|
95
|
-
// start before then. mkdir -p so fs.watch has something to bind to.
|
|
96
|
-
mkdirSync(projectsDir, { recursive: true });
|
|
97
|
-
const pendings = new Set();
|
|
98
|
-
let watcher = null;
|
|
99
|
-
function onWatchEvent(eventType, filename) {
|
|
100
|
-
if (!filename || !filename.endsWith('.jsonl'))
|
|
101
|
-
return;
|
|
102
|
-
const full = join(projectsDir, filename);
|
|
103
|
-
if (!existsSync(full))
|
|
104
|
-
return;
|
|
105
|
-
const { bound, head } = tryBindFile(full, pendings, logger);
|
|
106
|
-
if (bound) {
|
|
107
|
-
logger(`jsonl-observer matched event=${eventType} path=${full} bridgeSuffix=${bound.bridgeSuffix}`);
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
// No bind. If there are pending observations and the head is readable
|
|
111
|
-
// but the bridge suffix is missing, log the preview so an operator
|
|
112
|
-
// can see whether claude wrote a JSONL with a different suffix vs
|
|
113
|
-
// wrote nothing at all. Pendings=0 means no one is listening; skip.
|
|
114
|
-
if (pendings.size > 0 && head.length > 0) {
|
|
115
|
-
logger(`jsonl-observer watch-no-match event=${eventType} path=${full} head-bytes=${head.length} head-preview=${formatHeadPreview(head)} pendings=${pendings.size}`);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
try {
|
|
119
|
-
watcher = watch(projectsDir, { persistent: false }, onWatchEvent);
|
|
120
|
-
watcher.on('error', (err) => {
|
|
121
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
122
|
-
logger(`jsonl-observer watch-error dir=${projectsDir} message=${msg}`);
|
|
123
|
-
});
|
|
124
|
-
logger(`jsonl-observer armed dir=${projectsDir}`);
|
|
125
|
-
}
|
|
126
|
-
catch (err) {
|
|
127
|
-
// mkdir succeeded but watch failed — extremely unlikely. Log loudly;
|
|
128
|
-
// observations registered later will resolve only via the on-arm scan
|
|
129
|
-
// unless the operator restarts the manager.
|
|
130
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
131
|
-
logger(`jsonl-observer watch-init-failed dir=${projectsDir} message=${msg}`);
|
|
132
|
-
}
|
|
133
|
-
function observe(args) {
|
|
134
|
-
const { bridgeSuffix } = args;
|
|
135
|
-
let resolveFn;
|
|
136
|
-
const promise = new Promise((resolve) => {
|
|
137
|
-
resolveFn = resolve;
|
|
138
|
-
});
|
|
139
|
-
const pending = {
|
|
140
|
-
bridgeSuffix,
|
|
141
|
-
resolve: resolveFn,
|
|
142
|
-
settled: false,
|
|
143
|
-
};
|
|
144
|
-
// On-arm scan — close the race between this call and the fs.watch
|
|
145
|
-
// event firing for a JSONL Claude already wrote. Tracks how many
|
|
146
|
-
// JSONLs were inspected and emits a head-preview line for every
|
|
147
|
-
// unrelated file so an operator can see whether the project dir is
|
|
148
|
-
// empty (claude wrote nothing yet) vs full of unrelated JSONLs
|
|
149
|
-
// (claude wrote one but its head bytes don't carry our suffix).
|
|
150
|
-
pendings.add(pending);
|
|
151
|
-
let scannedHit = false;
|
|
152
|
-
let scannedFiles = 0;
|
|
153
|
-
try {
|
|
154
|
-
for (const entry of readdirSync(projectsDir, { withFileTypes: true })) {
|
|
155
|
-
if (!entry.isFile() || !entry.name.endsWith('.jsonl'))
|
|
156
|
-
continue;
|
|
157
|
-
scannedFiles++;
|
|
158
|
-
const full = join(projectsDir, entry.name);
|
|
159
|
-
const { bound, head } = tryBindFile(full, pendings, logger);
|
|
160
|
-
if (bound === pending) {
|
|
161
|
-
scannedHit = true;
|
|
162
|
-
logger(`jsonl-observer on-arm-scan-matched path=${full} bridgeSuffix=${bridgeSuffix}`);
|
|
163
|
-
break;
|
|
164
|
-
}
|
|
165
|
-
if (head.length > 0) {
|
|
166
|
-
logger(`jsonl-observer on-arm-scan-no-match path=${full} head-bytes=${head.length} head-preview=${formatHeadPreview(head)} bridgeSuffix=${bridgeSuffix}`);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
catch (err) {
|
|
171
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
172
|
-
logger(`jsonl-observer on-arm-scan-failed dir=${projectsDir} message=${msg}`);
|
|
173
|
-
}
|
|
174
|
-
if (!scannedHit) {
|
|
175
|
-
logger(`jsonl-observer pending bridgeSuffix=${bridgeSuffix} on-arm-files-scanned=${scannedFiles}`);
|
|
176
|
-
}
|
|
177
|
-
return {
|
|
178
|
-
promise,
|
|
179
|
-
cancel: () => {
|
|
180
|
-
if (pending.settled)
|
|
181
|
-
return;
|
|
182
|
-
pending.settled = true;
|
|
183
|
-
pendings.delete(pending);
|
|
184
|
-
pending.resolve(null);
|
|
185
|
-
logger(`jsonl-observer cancelled bridgeSuffix=${bridgeSuffix}`);
|
|
186
|
-
},
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
function close() {
|
|
190
|
-
if (watcher) {
|
|
191
|
-
watcher.close();
|
|
192
|
-
watcher = null;
|
|
193
|
-
}
|
|
194
|
-
for (const p of pendings) {
|
|
195
|
-
if (p.settled)
|
|
196
|
-
continue;
|
|
197
|
-
p.settled = true;
|
|
198
|
-
p.resolve(null);
|
|
199
|
-
}
|
|
200
|
-
pendings.clear();
|
|
201
|
-
}
|
|
202
|
-
return { observe, close };
|
|
203
|
-
}
|
|
204
|
-
//# sourceMappingURL=jsonl-observer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonl-observer.js","sourceRoot":"","sources":["../src/jsonl-observer.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,EAAE;AACF,2DAA2D;AAC3D,yEAAyE;AACzE,yEAAyE;AACzE,sEAAsE;AACtE,uEAAuE;AACvE,0EAA0E;AAC1E,uCAAuC;AACvC,EAAE;AACF,2EAA2E;AAC3E,uEAAuE;AACvE,kEAAkE;AAClE,yEAAyE;AACzE,yEAAyE;AACzE,qEAAqE;AACrE,iEAAiE;AACjE,EAAE;AACF,yEAAyE;AACzE,yEAAyE;AACzE,yEAAyE;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