pi-harness-runtime 1.1.397 → 1.1.402
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/AGENTS.md +44 -2
- package/CHANGELOG.md +21 -0
- package/RULES.md +28 -0
- package/harness/agent-handoff.ts +2 -3
- package/harness/autonomous-review.ts +1 -1
- package/harness/blackboard.ts +2 -3
- package/harness/context-compact-orchestrator.ts +1 -1
- package/harness/context-window-manager.ts +2 -2
- package/harness/e2e/playwright-runner.ts +6 -4
- package/harness/herdr-agents.ts +1 -1
- package/harness/job-state-machine.ts +1 -1
- package/harness/langchain/daemon.ts +3 -3
- package/harness/langchain/graph.ts +2 -2
- package/harness/langchain/ping-pong-middleware.ts +2 -2
- package/harness/loop-code-agent.ts +6 -4
- package/harness/loop-controller.ts +1 -1
- package/harness/loop-review-agent.ts +1 -1
- package/harness/loop-types.ts +1 -1
- package/harness/master-planner.ts +1 -1
- package/harness/notification-events.ts +6 -6
- package/harness/project-detector/detector.ts +1 -2
- package/harness/repair-engine.ts +2 -4
- package/harness/service-diagnostics.ts +1 -1
- package/harness/skill-sync.ts +3 -3
- package/index.ts +276 -55
- package/mirror.ts +1 -1
- package/package.json +5 -3
- package/packages/a2a-adapter/dist/discovery.d.ts.map +1 -1
- package/packages/a2a-adapter/dist/discovery.js +0 -1
- package/packages/a2a-adapter/dist/discovery.js.map +1 -1
- package/packages/a2a-adapter/package.json +1 -1
- package/packages/a2a-adapter/src/discovery.ts +0 -1
- package/packages/agent-policy/package.json +1 -1
- package/packages/architecture-generator/package.json +1 -1
- package/packages/auth/dist/index.d.ts +9 -0
- package/packages/auth/dist/index.d.ts.map +1 -0
- package/packages/auth/dist/index.js +9 -0
- package/packages/auth/dist/index.js.map +1 -0
- package/packages/auth/package.json +1 -1
- package/packages/auth/src/index.ts +9 -0
- package/packages/autonomous-refactor/package.json +1 -1
- package/packages/autonomous-runtime/package.json +1 -1
- package/packages/cache-strategy/package.json +1 -1
- package/packages/capability-registry/package.json +1 -1
- package/packages/checkpoint/package.json +1 -1
- package/packages/cli-plugin-sdk/package.json +1 -1
- package/packages/clipboard/package.json +1 -1
- package/packages/clipboard-plugin/package.json +1 -1
- package/packages/code-generation/package.json +1 -1
- package/packages/code-review/package.json +1 -1
- package/packages/codex-adapter/package.json +1 -1
- package/packages/codex-watcher/package.json +1 -1
- package/packages/config-capture/dist/index.d.ts +52 -0
- package/packages/config-capture/dist/index.d.ts.map +1 -0
- package/packages/config-capture/dist/index.js +261 -0
- package/packages/config-capture/dist/index.js.map +1 -0
- package/packages/config-capture/package.json +1 -1
- package/packages/connection-runtime/package.json +1 -1
- package/packages/context-compiler/package.json +1 -1
- package/packages/context-discovery/package.json +1 -1
- package/packages/context-manager/package.json +1 -1
- package/packages/contracts/package.json +1 -1
- package/packages/cookie-sanitizer/package.json +1 -1
- package/packages/cost-optimizer/package.json +1 -1
- package/packages/dependency-analyzer/package.json +1 -1
- package/packages/django-plugin/package.json +1 -1
- package/packages/doc-generator/package.json +1 -1
- package/packages/durable-review/package.json +1 -1
- package/packages/e2e-tester/package.json +1 -1
- package/packages/evaluation-engine/package.json +1 -1
- package/packages/evaluation-runner/package.json +1 -1
- package/packages/event-bus/package.json +1 -1
- package/packages/event-sink/package.json +1 -1
- package/packages/event-store/package.json +1 -1
- package/packages/experience-replay/package.json +1 -1
- package/packages/feedback-collector/package.json +1 -1
- package/packages/file-copy-helper/dist/extension.d.ts +15 -0
- package/packages/file-copy-helper/dist/extension.d.ts.map +1 -0
- package/packages/file-copy-helper/dist/extension.debug.d.ts +15 -0
- package/packages/file-copy-helper/dist/extension.debug.d.ts.map +1 -0
- package/packages/file-copy-helper/dist/extension.debug.js +215 -0
- package/packages/file-copy-helper/dist/extension.debug.js.map +1 -0
- package/packages/file-copy-helper/dist/extension.js +222 -0
- package/packages/file-copy-helper/dist/extension.js.map +1 -0
- package/packages/file-copy-helper/dist/index.d.ts +3 -0
- package/packages/file-copy-helper/dist/index.d.ts.map +1 -0
- package/packages/file-copy-helper/dist/index.js +3 -0
- package/packages/file-copy-helper/dist/index.js.map +1 -0
- package/packages/file-copy-helper/dist/intent-detector.d.ts +21 -0
- package/packages/file-copy-helper/dist/intent-detector.d.ts.map +1 -0
- package/packages/file-copy-helper/dist/intent-detector.js +348 -0
- package/packages/file-copy-helper/dist/intent-detector.js.map +1 -0
- package/packages/file-copy-helper/package.json +1 -1
- package/packages/framework-detector/package.json +1 -1
- package/packages/framework-plugin-sdk/package.json +1 -1
- package/packages/frappe-plugin/package.json +1 -1
- package/packages/generic-web-plugin/package.json +1 -1
- package/packages/health-monitor/package.json +1 -1
- package/packages/intent-analyzer/package.json +1 -1
- package/packages/jev-judge/dist/auto-continue.d.ts +161 -2
- package/packages/jev-judge/dist/auto-continue.d.ts.map +1 -1
- package/packages/jev-judge/dist/auto-continue.js +267 -22
- package/packages/jev-judge/dist/auto-continue.js.map +1 -1
- package/packages/jev-judge/dist/index.d.ts +2 -0
- package/packages/jev-judge/dist/index.d.ts.map +1 -1
- package/packages/jev-judge/dist/index.js +2 -0
- package/packages/jev-judge/dist/index.js.map +1 -1
- package/packages/jev-judge/dist/question-risk.d.ts +50 -0
- package/packages/jev-judge/dist/question-risk.d.ts.map +1 -0
- package/packages/jev-judge/dist/question-risk.js +100 -0
- package/packages/jev-judge/dist/question-risk.js.map +1 -0
- package/packages/jev-judge/package.json +1 -1
- package/packages/jev-judge/src/auto-continue.ts +426 -29
- package/packages/jev-judge/src/index.ts +4 -0
- package/packages/jev-judge/src/question-risk.ts +151 -0
- package/packages/jev-judge/tests/auto-continue-context.test.ts +221 -0
- package/packages/jev-judge/tests/outcome-application.test.ts +132 -0
- package/packages/jev-judge/tests/question-risk.test.ts +116 -0
- package/packages/knowledge-graph/package.json +1 -1
- package/packages/knowledge-retrieval/package.json +1 -1
- package/packages/laravel-plugin/package.json +1 -1
- package/packages/learning-engine/package.json +1 -1
- package/packages/logging/README.md +36 -3
- package/packages/logging/dist/config.d.ts +7 -0
- package/packages/logging/dist/config.d.ts.map +1 -1
- package/packages/logging/dist/config.js +14 -0
- package/packages/logging/dist/config.js.map +1 -1
- package/packages/logging/dist/incidents/schema.d.ts +111 -0
- package/packages/logging/dist/incidents/schema.d.ts.map +1 -0
- package/packages/logging/dist/incidents/schema.js +0 -0
- package/packages/logging/dist/incidents/schema.js.map +1 -0
- package/packages/logging/dist/index.d.ts +2 -0
- package/packages/logging/dist/index.d.ts.map +1 -1
- package/packages/logging/dist/index.js +2 -0
- package/packages/logging/dist/index.js.map +1 -1
- package/packages/logging/dist/server/http.d.ts +4 -3
- package/packages/logging/dist/server/http.d.ts.map +1 -1
- package/packages/logging/dist/server/http.js +35 -3
- package/packages/logging/dist/server/http.js.map +1 -1
- package/packages/logging/dist/server/incident-qdrant.d.ts +83 -0
- package/packages/logging/dist/server/incident-qdrant.d.ts.map +1 -0
- package/packages/logging/dist/server/incident-qdrant.js +129 -0
- package/packages/logging/dist/server/incident-qdrant.js.map +1 -0
- package/packages/logging/dist/server/incident-store.d.ts +76 -0
- package/packages/logging/dist/server/incident-store.d.ts.map +1 -0
- package/packages/logging/dist/server/incident-store.js +157 -0
- package/packages/logging/dist/server/incident-store.js.map +1 -0
- package/packages/logging/dist/server/index.d.ts +4 -0
- package/packages/logging/dist/server/index.d.ts.map +1 -1
- package/packages/logging/dist/server/index.js +2 -0
- package/packages/logging/dist/server/index.js.map +1 -1
- package/packages/logging/dist/server/service.d.ts +33 -0
- package/packages/logging/dist/server/service.d.ts.map +1 -1
- package/packages/logging/dist/server/service.js +63 -0
- package/packages/logging/dist/server/service.js.map +1 -1
- package/packages/logging/dist/shipper.d.ts +74 -3
- package/packages/logging/dist/shipper.d.ts.map +1 -1
- package/packages/logging/dist/shipper.js +88 -5
- package/packages/logging/dist/shipper.js.map +1 -1
- package/packages/logging/dist/singleton.d.ts.map +1 -1
- package/packages/logging/dist/singleton.js +1 -0
- package/packages/logging/dist/singleton.js.map +1 -1
- package/packages/logging/package.json +1 -1
- package/packages/logging/src/config.ts +22 -0
- package/packages/logging/src/incidents/schema.ts +0 -0
- package/packages/logging/src/index.ts +17 -0
- package/packages/logging/src/server/http.ts +42 -3
- package/packages/logging/src/server/incident-qdrant.ts +177 -0
- package/packages/logging/src/server/incident-store.ts +192 -0
- package/packages/logging/src/server/index.ts +21 -0
- package/packages/logging/src/server/service.ts +79 -0
- package/packages/logging/src/shipper.ts +120 -5
- package/packages/logging/src/singleton.ts +1 -0
- package/packages/logging/test/fanout.test.ts +186 -0
- package/packages/logging/test/incidents.test.ts +404 -0
- package/packages/mcp-adapter/package.json +1 -1
- package/packages/memory-engine/package.json +1 -1
- package/packages/milestone-manager/package.json +1 -1
- package/packages/model-registry/package.json +1 -1
- package/packages/nextjs-plugin/package.json +1 -1
- package/packages/notification/dist/adapters/detail-format.d.ts +42 -0
- package/packages/notification/dist/adapters/detail-format.d.ts.map +1 -0
- package/packages/notification/dist/adapters/detail-format.js +94 -0
- package/packages/notification/dist/adapters/detail-format.js.map +1 -0
- package/packages/notification/dist/adapters/email-adapter.d.ts.map +1 -1
- package/packages/notification/dist/adapters/email-adapter.js +3 -2
- package/packages/notification/dist/adapters/email-adapter.js.map +1 -1
- package/packages/notification/dist/adapters/line-adapter.d.ts +33 -0
- package/packages/notification/dist/adapters/line-adapter.d.ts.map +1 -1
- package/packages/notification/dist/adapters/line-adapter.js +87 -9
- package/packages/notification/dist/adapters/line-adapter.js.map +1 -1
- package/packages/notification/dist/adapters/ntfy-adapter.d.ts.map +1 -1
- package/packages/notification/dist/adapters/ntfy-adapter.js +3 -2
- package/packages/notification/dist/adapters/ntfy-adapter.js.map +1 -1
- package/packages/notification/dist/adapters/telegram-adapter.d.ts +14 -0
- package/packages/notification/dist/adapters/telegram-adapter.d.ts.map +1 -1
- package/packages/notification/dist/adapters/telegram-adapter.js +89 -69
- package/packages/notification/dist/adapters/telegram-adapter.js.map +1 -1
- package/packages/notification/dist/notification-center.d.ts.map +1 -1
- package/packages/notification/dist/notification-center.js +60 -7
- package/packages/notification/dist/notification-center.js.map +1 -1
- package/packages/notification/dist/pending-question.d.ts +69 -2
- package/packages/notification/dist/pending-question.d.ts.map +1 -1
- package/packages/notification/dist/pending-question.js +88 -2
- package/packages/notification/dist/pending-question.js.map +1 -1
- package/packages/notification/dist/types.d.ts +21 -0
- package/packages/notification/dist/types.d.ts.map +1 -1
- package/packages/notification/package.json +1 -1
- package/packages/notification/src/adapters/detail-format.ts +114 -0
- package/packages/notification/src/adapters/email-adapter.ts +3 -2
- package/packages/notification/src/adapters/line-adapter.ts +97 -9
- package/packages/notification/src/adapters/ntfy-adapter.ts +3 -2
- package/packages/notification/src/adapters/telegram-adapter.ts +98 -76
- package/packages/notification/src/notification-center.ts +66 -8
- package/packages/notification/src/pending-question.ts +160 -8
- package/packages/notification/src/types.ts +21 -0
- package/packages/notification/test/approval-payload.test.ts +269 -0
- package/packages/notification/test/detail-format.test.ts +106 -0
- package/packages/notification/test/pending-question-lifecycle.test.ts +195 -0
- package/packages/observability/package.json +1 -1
- package/packages/okf-indexer/dist/index.d.ts +9 -0
- package/packages/okf-indexer/dist/index.d.ts.map +1 -0
- package/packages/okf-indexer/dist/index.js +9 -0
- package/packages/okf-indexer/dist/index.js.map +1 -0
- package/packages/okf-indexer/package.json +1 -1
- package/packages/okf-indexer/src/index.ts +9 -0
- package/packages/paperclip-integration/package.json +1 -1
- package/packages/performance-optimizer/package.json +1 -1
- package/packages/permission-mode/package.json +1 -1
- package/packages/privilege-broker/package.json +1 -1
- package/packages/project-analyzer/package.json +1 -1
- package/packages/project-bootstrap/package.json +1 -1
- package/packages/projection-engine/package.json +1 -1
- package/packages/prompt-compiler/package.json +1 -1
- package/packages/prompt-versioning/package.json +1 -1
- package/packages/provider-adapter-sdk/package.json +1 -1
- package/packages/provider-router/dist/provider-router.d.ts.map +1 -1
- package/packages/provider-router/dist/types.d.ts +2 -2
- package/packages/provider-router/dist/types.d.ts.map +1 -1
- package/packages/provider-router/dist/types.js +1 -1
- package/packages/provider-router/package.json +1 -1
- package/packages/provider-router/src/types.ts +2 -2
- package/packages/provider-selector/package.json +1 -1
- package/packages/providers/package.json +1 -1
- package/packages/qdrant-skills/package.json +1 -1
- package/packages/quota-manager/package.json +1 -1
- package/packages/rate-limiter/package.json +1 -1
- package/packages/react-vite-plugin/package.json +1 -1
- package/packages/relay/package.json +1 -1
- package/packages/release-manager/package.json +1 -1
- package/packages/requirement-compiler/package.json +1 -1
- package/packages/runtime/package.json +1 -1
- package/packages/scheduler/dist/index.d.ts +9 -0
- package/packages/scheduler/dist/index.d.ts.map +1 -0
- package/packages/scheduler/dist/index.js +9 -0
- package/packages/scheduler/dist/index.js.map +1 -0
- package/packages/scheduler/dist/scheduler.d.ts +17 -0
- package/packages/scheduler/dist/scheduler.d.ts.map +1 -0
- package/packages/scheduler/dist/scheduler.js +41 -0
- package/packages/scheduler/dist/scheduler.js.map +1 -0
- package/packages/scheduler/package.json +1 -1
- package/packages/scheduler/src/index.ts +9 -0
- package/packages/scheduler-adapter/package.json +1 -1
- package/packages/session/package.json +1 -1
- package/packages/session-api/package.json +1 -1
- package/packages/session-export/package.json +1 -1
- package/packages/shared-context/dist/index.d.ts +7 -0
- package/packages/shared-context/dist/index.d.ts.map +1 -0
- package/packages/shared-context/dist/index.js +7 -0
- package/packages/shared-context/dist/index.js.map +1 -0
- package/packages/shared-context/dist/shared-context.d.ts +12 -0
- package/packages/shared-context/dist/shared-context.d.ts.map +1 -0
- package/packages/shared-context/dist/shared-context.js +39 -0
- package/packages/shared-context/dist/shared-context.js.map +1 -0
- package/packages/shared-context/package.json +1 -1
- package/packages/skill-mcp-client/dist/client.d.ts +56 -0
- package/packages/skill-mcp-client/dist/client.d.ts.map +1 -0
- package/packages/skill-mcp-client/dist/client.js +101 -0
- package/packages/skill-mcp-client/dist/client.js.map +1 -0
- package/packages/skill-mcp-client/dist/errors.d.ts +44 -0
- package/packages/skill-mcp-client/dist/errors.d.ts.map +1 -0
- package/packages/skill-mcp-client/dist/errors.js +68 -0
- package/packages/skill-mcp-client/dist/errors.js.map +1 -0
- package/packages/skill-mcp-client/dist/index.d.ts +9 -0
- package/packages/skill-mcp-client/dist/index.d.ts.map +1 -0
- package/packages/skill-mcp-client/dist/index.js +9 -0
- package/packages/skill-mcp-client/dist/index.js.map +1 -0
- package/packages/skill-mcp-client/dist/types.d.ts +106 -0
- package/packages/skill-mcp-client/dist/types.d.ts.map +1 -0
- package/packages/skill-mcp-client/dist/types.js +14 -0
- package/packages/skill-mcp-client/dist/types.js.map +1 -0
- package/packages/skill-mcp-client/package.json +1 -1
- package/packages/skill-registry/package.json +1 -1
- package/packages/skills/package.json +1 -5
- package/packages/sprint-planner/package.json +1 -1
- package/packages/subscription-engine/package.json +1 -1
- package/packages/task-compiler/package.json +1 -1
- package/packages/telegram/package.json +1 -1
- package/packages/telegram/src/agent-messages.d.ts +28 -0
- package/packages/telegram/src/agent-messages.js +90 -0
- package/packages/telegram/src/bindings.d.ts +296 -0
- package/packages/telegram/src/bindings.js +1086 -0
- package/packages/telegram/src/bus.d.ts +759 -0
- package/packages/telegram/src/bus.js +2732 -0
- package/packages/telegram/src/commands.d.ts +761 -0
- package/packages/telegram/src/commands.js +2622 -0
- package/packages/telegram/src/config.d.ts +222 -0
- package/packages/telegram/src/config.js +844 -0
- package/packages/telegram/src/delivery.d.ts +161 -0
- package/packages/telegram/src/delivery.js +550 -0
- package/packages/telegram/src/extension.d.ts +7 -0
- package/packages/telegram/src/extension.js +2444 -0
- package/packages/telegram/src/inbound.d.ts +94 -0
- package/packages/telegram/src/inbound.js +478 -0
- package/packages/telegram/src/index.d.ts +6 -0
- package/packages/telegram/src/index.js +6 -0
- package/packages/telegram/src/keyboard.d.ts +21 -0
- package/packages/telegram/src/keyboard.js +37 -0
- package/packages/telegram/src/lifecycle.d.ts +210 -0
- package/packages/telegram/src/lifecycle.js +538 -0
- package/packages/telegram/src/pi.d.ts +76 -0
- package/packages/telegram/src/pi.js +130 -0
- package/packages/telegram/src/polling.d.ts +332 -0
- package/packages/telegram/src/polling.js +1219 -0
- package/packages/telegram/src/replies.d.ts +210 -0
- package/packages/telegram/src/replies.js +752 -0
- package/packages/telegram/src/routing.d.ts +388 -0
- package/packages/telegram/src/routing.js +7886 -0
- package/packages/telegram/src/runtime.d.ts +159 -0
- package/packages/telegram/src/runtime.js +351 -0
- package/packages/telegram/src/telegram-api.d.ts +564 -0
- package/packages/telegram/src/telegram-api.js +1332 -0
- package/packages/telegram/src/turns.d.ts +108 -0
- package/packages/telegram/src/turns.js +482 -0
- package/packages/telegram/src/updates.d.ts +1545 -0
- package/packages/telegram/src/updates.js +6420 -0
- package/packages/tencentdb-memory/package.json +1 -1
- package/packages/tencentdb-sync/package.json +1 -1
- package/packages/test-data-generator/package.json +1 -1
- package/packages/test-generator/package.json +1 -1
- package/packages/todo-bd-sync/dist/detector.d.ts +54 -0
- package/packages/todo-bd-sync/dist/detector.d.ts.map +1 -0
- package/packages/todo-bd-sync/dist/detector.js +132 -0
- package/packages/todo-bd-sync/dist/detector.js.map +1 -0
- package/packages/todo-bd-sync/dist/extension.d.ts +30 -0
- package/packages/todo-bd-sync/dist/extension.d.ts.map +1 -0
- package/packages/todo-bd-sync/dist/extension.js +35 -0
- package/packages/todo-bd-sync/dist/extension.js.map +1 -0
- package/packages/todo-bd-sync/dist/index.d.ts +87 -0
- package/packages/todo-bd-sync/dist/index.d.ts.map +1 -0
- package/packages/todo-bd-sync/dist/index.js +296 -0
- package/packages/todo-bd-sync/dist/index.js.map +1 -0
- package/packages/todo-bd-sync/dist/sync.d.ts +72 -0
- package/packages/todo-bd-sync/dist/sync.d.ts.map +1 -0
- package/packages/todo-bd-sync/dist/sync.js +290 -0
- package/packages/todo-bd-sync/dist/sync.js.map +1 -0
- package/packages/todo-bd-sync/dist/task-analyzer.d.ts +49 -0
- package/packages/todo-bd-sync/dist/task-analyzer.d.ts.map +1 -0
- package/packages/todo-bd-sync/dist/task-analyzer.js +240 -0
- package/packages/todo-bd-sync/dist/task-analyzer.js.map +1 -0
- package/packages/todo-bd-sync/dist/todo-reminder.d.ts +126 -0
- package/packages/todo-bd-sync/dist/todo-reminder.d.ts.map +1 -0
- package/packages/todo-bd-sync/dist/todo-reminder.js +329 -0
- package/packages/todo-bd-sync/dist/todo-reminder.js.map +1 -0
- package/packages/todo-bd-sync/dist/types.d.ts +65 -0
- package/packages/todo-bd-sync/dist/types.d.ts.map +1 -0
- package/packages/todo-bd-sync/dist/types.js +67 -0
- package/packages/todo-bd-sync/dist/types.js.map +1 -0
- package/packages/todo-bd-sync/package.json +1 -1
- package/packages/token-estimation/dist/index.d.ts +94 -0
- package/packages/token-estimation/dist/index.d.ts.map +1 -0
- package/packages/token-estimation/dist/index.js +115 -0
- package/packages/token-estimation/dist/index.js.map +1 -0
- package/packages/token-estimation/package.json +1 -1
- package/packages/token-optimizer/package.json +1 -1
- package/packages/trajectory/package.json +1 -1
- package/packages/tui/package.json +1 -1
- package/packages/types/dist/ai-providers.d.ts +36 -0
- package/packages/types/dist/ai-providers.d.ts.map +1 -0
- package/packages/types/dist/ai-providers.js +66 -0
- package/packages/types/dist/ai-providers.js.map +1 -0
- package/packages/types/dist/index.d.ts +12 -0
- package/packages/types/dist/index.d.ts.map +1 -0
- package/packages/types/dist/index.js +12 -0
- package/packages/types/dist/index.js.map +1 -0
- package/packages/types/package.json +5 -5
- package/packages/types/src/index.ts +12 -0
- package/packages/voice-api/package.json +1 -1
- package/packages/webmcp-tester/package.json +1 -1
- package/packages/wiki/package.json +1 -1
- package/packages/workflow-events/package.json +1 -1
- package/packages/workspace-scanner/package.json +1 -1
- package/packages/worktree/package.json +1 -1
- package/packages/worktree/worktree.ts +1 -1
- package/packages/write-review/package.json +1 -1
- package/renderer.ts +1 -1
- package/scripts/build-packages.ts +162 -0
- package/scripts/relay-client.ts +2 -2
- package/scripts/typecheck-packages.mjs +3 -3
- package/scripts/unified-webhook-server.ts +22 -10
- package/scripts/verify-package-contents.ts +345 -0
- package/scripts/ws-server.ts +1 -1
- package/tracker.ts +1 -1
- package/harness/browser-scrapers/base-browser-scraper.d.ts +0 -91
- package/harness/browser-scrapers/chrome-profile-manager.d.ts +0 -80
- package/harness/browser-scrapers/codex-browser-scraper.d.ts +0 -60
- package/harness/browser-scrapers/index.d.ts +0 -29
- package/harness/browser-scrapers/zai-browser-scraper.d.ts +0 -79
- package/harness/e2e/browser-scrapers/base-browser-scraper.d.ts +0 -92
- package/harness/e2e/browser-scrapers/chrome-profile-manager.d.ts +0 -81
- package/harness/e2e/browser-scrapers/codex-browser-scraper.d.ts +0 -61
- package/harness/e2e/browser-scrapers/index.d.ts +0 -30
- package/harness/e2e/browser-scrapers/zai-browser-scraper.d.ts +0 -80
- package/harness/langchain/agents.d.ts +0 -143
- package/harness/langchain/agents.test.d.ts +0 -2
- package/harness/langchain/checkpointer.d.ts +0 -48
- package/harness/langchain/checkpointer.test.d.ts +0 -8
- package/harness/langchain/cron-cli.d.ts +0 -12
- package/harness/langchain/daemon.d.ts +0 -161
- package/harness/langchain/daemon.test.d.ts +0 -11
- package/harness/langchain/file-tools.d.ts +0 -97
- package/harness/langchain/graph.d.ts +0 -706
- package/harness/langchain/model-router.d.ts +0 -63
- package/harness/langchain/model-router.test.d.ts +0 -2
- package/harness/langchain/models.d.ts +0 -72
- package/harness/langchain/ping-pong-middleware.d.ts +0 -28
- package/harness/langchain/ping-pong-middleware.test.d.ts +0 -2
- package/harness/langchain/run.d.ts +0 -15
- package/harness/langchain/scoreboard.test.d.ts +0 -13
- package/harness/langchain/status-line.d.ts +0 -91
- package/harness/langchain/status-line.test.d.ts +0 -8
- package/harness/langchain/surge.d.ts +0 -111
- package/harness/langchain/surge.test.d.ts +0 -10
- package/harness/langchain/widget.d.ts +0 -105
- package/harness/langchain/widget.test.d.ts +0 -8
- package/packages/autonomous-runtime/dist/worker.d.ts +0 -63
- package/packages/autonomous-runtime/dist/worker.js +0 -133
- package/packages/capability-registry/src/types.d.ts +0 -47
- package/packages/clipboard/dist/clipboard.d.ts +0 -11
- package/packages/clipboard/dist/clipboard.js +0 -40
- package/packages/clipboard/dist/index.d.ts +0 -2
- package/packages/clipboard/dist/index.js +0 -2
- package/packages/clipboard/dist/types.d.ts +0 -13
- package/packages/clipboard/dist/types.js +0 -5
- package/packages/context-discovery/dist/discover.d.ts +0 -3
- package/packages/context-discovery/dist/discover.js +0 -42
- package/packages/context-discovery/dist/discovery.d.ts +0 -28
- package/packages/context-discovery/dist/discovery.js +0 -21
- package/packages/context-discovery/dist/index.d.ts +0 -3
- package/packages/context-discovery/dist/index.js +0 -2
- package/packages/context-discovery/dist/types.d.ts +0 -16
- package/packages/context-discovery/dist/types.js +0 -2
- package/packages/event-bus/dist/bus.d.ts +0 -15
- package/packages/event-bus/dist/bus.js +0 -90
- package/packages/event-bus/dist/index.d.ts +0 -4
- package/packages/event-bus/dist/index.js +0 -3
- package/packages/event-bus/dist/test/bus.test.js +0 -52
- package/packages/event-bus/dist/types.d.ts +0 -27
- package/packages/event-bus/dist/types.js +0 -10
- package/packages/event-store/dist/index.d.ts +0 -3
- package/packages/event-store/dist/index.js +0 -2
- package/packages/event-store/dist/store.d.ts +0 -15
- package/packages/event-store/dist/store.js +0 -131
- package/packages/event-store/dist/test/store.test.js +0 -57
- package/packages/event-store/dist/types.d.ts +0 -48
- package/packages/event-store/dist/types.js +0 -5
- package/packages/event-store/src/types.d.ts +0 -48
- package/packages/file-copy-helper/dist/src/extension.js +0 -186
- package/packages/model-registry/src/types.d.ts +0 -63
- package/packages/notification/dist/src/adapters/email-adapter.d.ts +0 -17
- package/packages/notification/dist/src/adapters/email-adapter.d.ts.map +0 -1
- package/packages/notification/dist/src/adapters/email-adapter.js +0 -89
- package/packages/notification/dist/src/adapters/email-adapter.js.map +0 -1
- package/packages/notification/dist/src/adapters/line-adapter.d.ts +0 -17
- package/packages/notification/dist/src/adapters/line-adapter.d.ts.map +0 -1
- package/packages/notification/dist/src/adapters/line-adapter.js +0 -99
- package/packages/notification/dist/src/adapters/line-adapter.js.map +0 -1
- package/packages/notification/dist/src/adapters/ntfy-adapter.d.ts +0 -17
- package/packages/notification/dist/src/adapters/ntfy-adapter.d.ts.map +0 -1
- package/packages/notification/dist/src/adapters/ntfy-adapter.js +0 -84
- package/packages/notification/dist/src/adapters/ntfy-adapter.js.map +0 -1
- package/packages/notification/dist/src/adapters/telegram-adapter.d.ts +0 -56
- package/packages/notification/dist/src/adapters/telegram-adapter.d.ts.map +0 -1
- package/packages/notification/dist/src/adapters/telegram-adapter.js +0 -251
- package/packages/notification/dist/src/adapters/telegram-adapter.js.map +0 -1
- package/packages/notification/dist/src/adapters/webhook-adapter.d.ts +0 -15
- package/packages/notification/dist/src/adapters/webhook-adapter.d.ts.map +0 -1
- package/packages/notification/dist/src/adapters/webhook-adapter.js +0 -64
- package/packages/notification/dist/src/adapters/webhook-adapter.js.map +0 -1
- package/packages/notification/dist/src/base-adapter.d.ts +0 -36
- package/packages/notification/dist/src/base-adapter.d.ts.map +0 -1
- package/packages/notification/dist/src/base-adapter.js +0 -39
- package/packages/notification/dist/src/base-adapter.js.map +0 -1
- package/packages/notification/dist/src/index.d.ts +0 -12
- package/packages/notification/dist/src/index.d.ts.map +0 -1
- package/packages/notification/dist/src/index.js +0 -12
- package/packages/notification/dist/src/index.js.map +0 -1
- package/packages/notification/dist/src/notification-center.d.ts +0 -89
- package/packages/notification/dist/src/notification-center.d.ts.map +0 -1
- package/packages/notification/dist/src/notification-center.js +0 -356
- package/packages/notification/dist/src/notification-center.js.map +0 -1
- package/packages/notification/dist/src/notification-policy.d.ts +0 -66
- package/packages/notification/dist/src/notification-policy.d.ts.map +0 -1
- package/packages/notification/dist/src/notification-policy.js +0 -153
- package/packages/notification/dist/src/notification-policy.js.map +0 -1
- package/packages/notification/dist/src/telegram-webhook-handler.d.ts +0 -86
- package/packages/notification/dist/src/telegram-webhook-handler.d.ts.map +0 -1
- package/packages/notification/dist/src/telegram-webhook-handler.js +0 -149
- package/packages/notification/dist/src/telegram-webhook-handler.js.map +0 -1
- package/packages/notification/dist/src/types.d.ts +0 -106
- package/packages/notification/dist/src/types.d.ts.map +0 -1
- package/packages/notification/dist/src/types.js +0 -7
- package/packages/notification/dist/src/types.js.map +0 -1
- package/packages/projection-engine/dist/engine.d.ts +0 -61
- package/packages/projection-engine/dist/engine.js +0 -76
- package/packages/projection-engine/dist/index.d.ts +0 -2
- package/packages/projection-engine/dist/index.js +0 -2
- package/packages/projection-engine/dist/project.d.ts +0 -3
- package/packages/projection-engine/dist/project.js +0 -24
- package/packages/projection-engine/dist/types.d.ts +0 -55
- package/packages/projection-engine/dist/types.js +0 -5
- package/packages/projection-engine/src/types.d.ts +0 -55
- package/packages/provider-adapter-sdk/dist/src/builder.d.ts +0 -140
- package/packages/provider-adapter-sdk/dist/src/builder.d.ts.map +0 -1
- package/packages/provider-adapter-sdk/dist/src/builder.js +0 -332
- package/packages/provider-adapter-sdk/dist/src/builder.js.map +0 -1
- package/packages/provider-adapter-sdk/dist/src/errors.d.ts +0 -71
- package/packages/provider-adapter-sdk/dist/src/errors.d.ts.map +0 -1
- package/packages/provider-adapter-sdk/dist/src/errors.js +0 -111
- package/packages/provider-adapter-sdk/dist/src/errors.js.map +0 -1
- package/packages/provider-adapter-sdk/dist/src/index.d.ts +0 -15
- package/packages/provider-adapter-sdk/dist/src/index.d.ts.map +0 -1
- package/packages/provider-adapter-sdk/dist/src/index.js +0 -19
- package/packages/provider-adapter-sdk/dist/src/index.js.map +0 -1
- package/packages/provider-adapter-sdk/dist/src/registry.d.ts +0 -108
- package/packages/provider-adapter-sdk/dist/src/registry.d.ts.map +0 -1
- package/packages/provider-adapter-sdk/dist/src/registry.js +0 -301
- package/packages/provider-adapter-sdk/dist/src/registry.js.map +0 -1
- package/packages/provider-adapter-sdk/dist/src/tester.d.ts +0 -71
- package/packages/provider-adapter-sdk/dist/src/tester.d.ts.map +0 -1
- package/packages/provider-adapter-sdk/dist/src/tester.js +0 -392
- package/packages/provider-adapter-sdk/dist/src/tester.js.map +0 -1
- package/packages/provider-adapter-sdk/dist/src/types.d.ts +0 -182
- package/packages/provider-adapter-sdk/dist/src/types.d.ts.map +0 -1
- package/packages/provider-adapter-sdk/dist/src/types.js +0 -11
- package/packages/provider-adapter-sdk/dist/src/types.js.map +0 -1
- package/packages/provider-router/dist/capability-registry/src/types.d.ts +0 -47
- package/packages/provider-router/dist/capability-registry/src/types.d.ts.map +0 -1
- package/packages/provider-router/dist/capability-registry/src/types.js +0 -10
- package/packages/provider-router/dist/capability-registry/src/types.js.map +0 -1
- package/packages/provider-router/dist/provider-router/src/index.d.ts +0 -23
- package/packages/provider-router/dist/provider-router/src/index.d.ts.map +0 -1
- package/packages/provider-router/dist/provider-router/src/index.js +0 -25
- package/packages/provider-router/dist/provider-router/src/index.js.map +0 -1
- package/packages/provider-router/dist/provider-router/src/policy.d.ts +0 -10
- package/packages/provider-router/dist/provider-router/src/policy.d.ts.map +0 -1
- package/packages/provider-router/dist/provider-router/src/policy.js +0 -45
- package/packages/provider-router/dist/provider-router/src/policy.js.map +0 -1
- package/packages/provider-router/dist/provider-router/src/provider-router.d.ts +0 -56
- package/packages/provider-router/dist/provider-router/src/provider-router.d.ts.map +0 -1
- package/packages/provider-router/dist/provider-router/src/provider-router.js +0 -222
- package/packages/provider-router/dist/provider-router/src/provider-router.js.map +0 -1
- package/packages/provider-router/dist/provider-router/src/strategies.d.ts +0 -19
- package/packages/provider-router/dist/provider-router/src/strategies.d.ts.map +0 -1
- package/packages/provider-router/dist/provider-router/src/strategies.js +0 -110
- package/packages/provider-router/dist/provider-router/src/strategies.js.map +0 -1
- package/packages/provider-router/dist/provider-router/src/types.d.ts +0 -91
- package/packages/provider-router/dist/provider-router/src/types.d.ts.map +0 -1
- package/packages/provider-router/dist/provider-router/src/types.js +0 -10
- package/packages/provider-router/dist/provider-router/src/types.js.map +0 -1
- package/packages/provider-router/dist/src/index.d.ts +0 -23
- package/packages/provider-router/dist/src/index.d.ts.map +0 -1
- package/packages/provider-router/dist/src/index.js +0 -25
- package/packages/provider-router/dist/src/index.js.map +0 -1
- package/packages/provider-router/dist/src/policy.d.ts +0 -10
- package/packages/provider-router/dist/src/policy.d.ts.map +0 -1
- package/packages/provider-router/dist/src/policy.js +0 -45
- package/packages/provider-router/dist/src/policy.js.map +0 -1
- package/packages/provider-router/dist/src/provider-router.d.ts +0 -56
- package/packages/provider-router/dist/src/provider-router.d.ts.map +0 -1
- package/packages/provider-router/dist/src/provider-router.js +0 -222
- package/packages/provider-router/dist/src/provider-router.js.map +0 -1
- package/packages/provider-router/dist/src/strategies.d.ts +0 -19
- package/packages/provider-router/dist/src/strategies.d.ts.map +0 -1
- package/packages/provider-router/dist/src/strategies.js +0 -110
- package/packages/provider-router/dist/src/strategies.js.map +0 -1
- package/packages/provider-router/dist/src/types.d.ts +0 -91
- package/packages/provider-router/dist/src/types.d.ts.map +0 -1
- package/packages/provider-router/dist/src/types.js +0 -10
- package/packages/provider-router/dist/src/types.js.map +0 -1
- package/packages/provider-router/dist/types/src/runtime-types.d.ts +0 -412
- package/packages/provider-router/dist/types/src/runtime-types.d.ts.map +0 -1
- package/packages/provider-router/dist/types/src/runtime-types.js +0 -2
- package/packages/provider-router/dist/types/src/runtime-types.js.map +0 -1
- package/packages/session-api/dist/api.d.ts +0 -83
- package/packages/session-api/dist/api.js +0 -35
- package/packages/session-api/dist/index.d.ts +0 -2
- package/packages/session-api/dist/index.js +0 -2
- package/packages/session-api/dist/types.d.ts +0 -22
- package/packages/session-api/dist/types.js +0 -5
- package/packages/session-export/dist/exporter.d.ts +0 -28
- package/packages/session-export/dist/exporter.js +0 -38
- package/packages/session-export/dist/index.d.ts +0 -2
- package/packages/session-export/dist/index.js +0 -2
- package/packages/session-export/dist/types.d.ts +0 -20
- package/packages/session-export/dist/types.js +0 -5
- package/packages/subscription-engine/dist/engine.d.ts +0 -13
- package/packages/subscription-engine/dist/engine.js +0 -40
- package/packages/subscription-engine/dist/index.d.ts +0 -2
- package/packages/subscription-engine/dist/index.js +0 -2
- package/packages/subscription-engine/dist/subscriptions.d.ts +0 -19
- package/packages/subscription-engine/dist/subscriptions.js +0 -32
- package/packages/subscription-engine/dist/types.d.ts +0 -24
- package/packages/subscription-engine/dist/types.js +0 -5
- package/packages/trajectory/test/store.test.d.ts +0 -2
- package/packages/workflow-events/dist/events.d.ts +0 -38
- package/packages/workflow-events/dist/events.js +0 -46
- package/packages/workflow-events/dist/index.d.ts +0 -2
- package/packages/workflow-events/dist/index.js +0 -2
- package/packages/workflow-events/dist/pipeline.d.ts +0 -21
- package/packages/workflow-events/dist/pipeline.js +0 -27
- package/packages/workflow-events/dist/types.d.ts +0 -110
- package/packages/workflow-events/dist/types.js +0 -5
- package/packages/workflow-events/src/types.d.ts +0 -110
|
@@ -21,9 +21,9 @@ import { existsSync, readFileSync, writeFileSync, appendFileSync, mkdirSync } fr
|
|
|
21
21
|
import { join } from "node:path";
|
|
22
22
|
import { homedir } from "os";
|
|
23
23
|
import { createServer, IncomingMessage, ServerResponse } from "node:http";
|
|
24
|
-
import { createRelayServer } from "../packages/relay/
|
|
25
|
-
import { resolveRelayEndpoint } from "../packages/relay/
|
|
26
|
-
import { generateMessageId } from "../packages/relay/
|
|
24
|
+
import { createRelayServer } from "../packages/relay/dist/server.js";
|
|
25
|
+
import { resolveRelayEndpoint } from "../packages/relay/dist/relay-endpoint.js";
|
|
26
|
+
import { generateMessageId } from "../packages/relay/dist/types.js";
|
|
27
27
|
import type { CallbackPayload } from "../packages/relay/src/types";
|
|
28
28
|
import type { RelayServerOptions } from "../packages/relay/src/server";
|
|
29
29
|
// One implementation of the Telegram allow-list (env var, key file, legacy
|
|
@@ -33,6 +33,7 @@ import { getAllowedUserIds, isAuthorizedTelegramSender } from "../harness/telegr
|
|
|
33
33
|
// /api/logs, the server queues them durably and a worker uploads them to
|
|
34
34
|
// Cloudflare R2.
|
|
35
35
|
import {
|
|
36
|
+
IncidentStore,
|
|
36
37
|
LogCredentialStore,
|
|
37
38
|
LogIndexStore,
|
|
38
39
|
LogIngestService,
|
|
@@ -40,7 +41,7 @@ import {
|
|
|
40
41
|
LogOutboxWorker,
|
|
41
42
|
createLogHttpHandler,
|
|
42
43
|
serverObjectKey,
|
|
43
|
-
} from "../packages/logging/
|
|
44
|
+
} from "../packages/logging/dist/server/index.js";
|
|
44
45
|
import type { OutboxEntry } from "../packages/logging/src/server/outbox";
|
|
45
46
|
import { loadR2Config, R2Client } from "./r2-storage";
|
|
46
47
|
|
|
@@ -92,6 +93,8 @@ const LOG_INGEST_DIR = join(process.env.HOME || homedir() || "/tmp", ".pi-harnes
|
|
|
92
93
|
const LOG_OUTBOX_DIR = join(process.env.HOME || homedir() || "/tmp", ".pi-harness-runtime", "logs", "outbox");
|
|
93
94
|
/** Metadata index used by the query endpoint. */
|
|
94
95
|
const LOG_INDEX_DIR = join(process.env.HOME || homedir() || "/tmp", ".pi-harness-runtime", "logs", "index");
|
|
96
|
+
/** Durable storage of the derived incidents, one file per tenant and day. */
|
|
97
|
+
const LOG_INCIDENT_DIR = join(process.env.HOME || homedir() || "/tmp", ".pi-harness-runtime", "logs", "incidents");
|
|
95
98
|
/** Largest accepted ingest body (2 MB). A batch is NDJSON, so this is generous. */
|
|
96
99
|
const LOG_INGEST_MAX_BYTES = 2 * 1024 * 1024;
|
|
97
100
|
/** Largest accepted query body (64 KB is plenty for a filter object). */
|
|
@@ -107,10 +110,14 @@ const LOG_QUERY_MAX_BYTES = 64 * 1024;
|
|
|
107
110
|
const logCredentials = LogCredentialStore.load();
|
|
108
111
|
const logOutbox = new LogOutbox({ dir: LOG_OUTBOX_DIR });
|
|
109
112
|
const logIndex = new LogIndexStore({ dir: LOG_INDEX_DIR });
|
|
113
|
+
const logIncidents = new IncidentStore({ dir: LOG_INCIDENT_DIR });
|
|
110
114
|
const logService = new LogIngestService({
|
|
111
115
|
credentials: logCredentials,
|
|
112
116
|
outbox: logOutbox,
|
|
113
117
|
index: logIndex,
|
|
118
|
+
// The derived incidents: a versioned, tenant scoped view of what is
|
|
119
|
+
// actually going wrong.
|
|
120
|
+
incidents: logIncidents,
|
|
114
121
|
});
|
|
115
122
|
/** The HTTP surface of the log service (ingest, query, diagnostics). */
|
|
116
123
|
const logHttpHandler = createLogHttpHandler({
|
|
@@ -553,12 +560,17 @@ async function handleLINE(req: IncomingMessage, res: ServerResponse, config: Con
|
|
|
553
560
|
queueCallback(callback);
|
|
554
561
|
}
|
|
555
562
|
|
|
556
|
-
// Write to job commands file (for pi-harness HTTP polling)
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
563
|
+
// Write to job commands file (for pi-harness HTTP polling).
|
|
564
|
+
// Only the job commands belong there: an approval action resolves a
|
|
565
|
+
// pending question and travels through the callback path, so the
|
|
566
|
+
// job command queue must not receive it.
|
|
567
|
+
if (action === "resume" || action === "cancel") {
|
|
568
|
+
writeJobCommand({
|
|
569
|
+
command: action,
|
|
570
|
+
jobId: targetId,
|
|
571
|
+
userId: parseInt(event.source?.userId || "0", 10) || 0,
|
|
572
|
+
});
|
|
573
|
+
}
|
|
562
574
|
|
|
563
575
|
console.log(`[LINE] Postback: ${action} ${targetId} (WS clients: ${wsCount})`);
|
|
564
576
|
}
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* Verify that the published `pi-harness-runtime` package is a SINGLE, self
|
|
4
|
+
* contained app.
|
|
5
|
+
*
|
|
6
|
+
* The user installs one package:
|
|
7
|
+
*
|
|
8
|
+
* npm install pi-harness-runtime
|
|
9
|
+
*
|
|
10
|
+
* and must get every internal app with it. The internal packages are not
|
|
11
|
+
* published on their own, so the runtime reaches them through relative paths
|
|
12
|
+
* into `packages/<name>/...`. That only works when:
|
|
13
|
+
*
|
|
14
|
+
* 1. every internal package was built (its `dist` exists), and
|
|
15
|
+
* 2. every VALUE import of the shipped runtime resolves to a file that the
|
|
16
|
+
* build produces, and
|
|
17
|
+
* 3. the tarball that npm publishes actually contains those files.
|
|
18
|
+
*
|
|
19
|
+
* A type-only import is erased at runtime, so it may keep pointing at the
|
|
20
|
+
* source. A value import may not: `packages/<pkg>/src/<file>.js` only exists
|
|
21
|
+
* when somebody compiled the package in place, and a clean build emits into
|
|
22
|
+
* `dist/`. The published app would then fail to import it.
|
|
23
|
+
*
|
|
24
|
+
* Usage:
|
|
25
|
+
* bun scripts/verify-package-contents.ts # file checks
|
|
26
|
+
* bun scripts/verify-package-contents.ts --pack # also inspect the tarball
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
30
|
+
import { execFile, spawnSync } from "node:child_process";
|
|
31
|
+
import { join, resolve, dirname, relative } from "node:path";
|
|
32
|
+
import { fileURLToPath } from "node:url";
|
|
33
|
+
|
|
34
|
+
const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
35
|
+
const verifyTarball = process.argv.includes("--pack");
|
|
36
|
+
|
|
37
|
+
interface Problem {
|
|
38
|
+
kind: "missing-dist" | "missing-import" | "missing-tarball" | "missing-package";
|
|
39
|
+
detail: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const problems: Problem[] = [];
|
|
43
|
+
/** Every runtime import that must resolve: "file -> specifier". */
|
|
44
|
+
const runtimeImports = new Map<string, { file: string; specifier: string; target: string }>();
|
|
45
|
+
|
|
46
|
+
/** Every directory whose sources are part of the published tarball. */
|
|
47
|
+
const SHIPPED_SOURCE_DIRS = ["harness", "scripts", "packages"];
|
|
48
|
+
|
|
49
|
+
const SHIPPED_ROOT_FILES = [
|
|
50
|
+
"index.ts",
|
|
51
|
+
"status-parsers.ts",
|
|
52
|
+
"tracker.ts",
|
|
53
|
+
"windows.ts",
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
function listFiles(dir: string, filter: (file: string) => boolean): string[] {
|
|
57
|
+
if (!existsSync(dir)) return [];
|
|
58
|
+
const out: string[] = [];
|
|
59
|
+
for (const entry of readdirSync(dir)) {
|
|
60
|
+
const full = join(dir, entry);
|
|
61
|
+
let isDir = false;
|
|
62
|
+
try {
|
|
63
|
+
isDir = statSync(full).isDirectory();
|
|
64
|
+
} catch {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
if (isDir) {
|
|
68
|
+
// node_modules and the build output of a package are not sources.
|
|
69
|
+
if (entry === "node_modules" || entry === "dist" || entry === ".git") continue;
|
|
70
|
+
out.push(...listFiles(full, filter));
|
|
71
|
+
} else if (filter(full)) {
|
|
72
|
+
out.push(full);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return out;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function isSourceFile(file: string): boolean {
|
|
79
|
+
return /\.(ts|mts|cts|mjs|js)$/.test(file) && !file.endsWith(".d.ts");
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Every source file that ends up in the published package. */
|
|
83
|
+
function shippedSourceFiles(): string[] {
|
|
84
|
+
const files: string[] = [];
|
|
85
|
+
for (const name of SHIPPED_ROOT_FILES) {
|
|
86
|
+
const full = join(ROOT, name);
|
|
87
|
+
if (existsSync(full)) files.push(full);
|
|
88
|
+
}
|
|
89
|
+
for (const dir of SHIPPED_SOURCE_DIRS) {
|
|
90
|
+
files.push(...listFiles(join(ROOT, dir), isSourceFile));
|
|
91
|
+
}
|
|
92
|
+
return files;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// A value import: a static import without the `type` keyword, a dynamic
|
|
96
|
+
// import or a side effect import.
|
|
97
|
+
const STATIC_IMPORT = /import\s+(type\s+)?[^;]*?from\s*["']([^"']+)["']/g;
|
|
98
|
+
const DYNAMIC_IMPORT = /import\s*\(\s*["']([^"']+)["']\s*\)/g;
|
|
99
|
+
const SIDE_EFFECT_IMPORT = /(?:^|\n)\s*import\s*["']([^"']+)["']/g;
|
|
100
|
+
|
|
101
|
+
function checkImports(): void {
|
|
102
|
+
for (const file of shippedSourceFiles()) {
|
|
103
|
+
const content = readFileSync(file, "utf8");
|
|
104
|
+
const consider = (specifier: string) => {
|
|
105
|
+
if (!specifier.startsWith(".")) return;
|
|
106
|
+
if (!specifier.includes("packages/")) return;
|
|
107
|
+
const target = resolve(dirname(file), specifier);
|
|
108
|
+
const key = `${file} -> ${specifier}`;
|
|
109
|
+
runtimeImports.set(key, { file, specifier, target });
|
|
110
|
+
if (!existsSync(target)) {
|
|
111
|
+
problems.push({
|
|
112
|
+
kind: "missing-import",
|
|
113
|
+
detail: `${relative(ROOT, file)} imports ${specifier} but ${
|
|
114
|
+
relative(ROOT, target)
|
|
115
|
+
} does not exist`,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
for (const match of content.matchAll(STATIC_IMPORT)) {
|
|
121
|
+
if (match[1]) continue; // type-only import: erased at runtime
|
|
122
|
+
consider(match[2]);
|
|
123
|
+
}
|
|
124
|
+
for (const match of content.matchAll(DYNAMIC_IMPORT)) consider(match[1]);
|
|
125
|
+
for (const match of content.matchAll(SIDE_EFFECT_IMPORT)) consider(match[1]);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Collect every file path a package manifest promises to publish. */
|
|
130
|
+
function manifestEntries(manifest: {
|
|
131
|
+
main?: string;
|
|
132
|
+
exports?: unknown;
|
|
133
|
+
bin?: unknown;
|
|
134
|
+
}): string[] {
|
|
135
|
+
const entries: string[] = [];
|
|
136
|
+
if (typeof manifest.main === "string") entries.push(manifest.main);
|
|
137
|
+
if (typeof manifest.bin === "string") entries.push(manifest.bin);
|
|
138
|
+
else if (manifest.bin && typeof manifest.bin === "object") {
|
|
139
|
+
for (const value of Object.values(manifest.bin as Record<string, string>)) {
|
|
140
|
+
if (typeof value === "string") entries.push(value);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const walk = (node: unknown): void => {
|
|
145
|
+
if (typeof node === "string") {
|
|
146
|
+
if (node.startsWith("./")) entries.push(node);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (node && typeof node === "object") {
|
|
150
|
+
for (const value of Object.values(node as Record<string, unknown>)) walk(value);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
walk(manifest.exports);
|
|
154
|
+
|
|
155
|
+
return [...new Set(entries)];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** Is the file tracked by git? A clean checkout only has tracked files. */
|
|
159
|
+
function isTracked(file: string): boolean {
|
|
160
|
+
const run = spawnSync("git", ["ls-files", "--error-unmatch", "--", file], {
|
|
161
|
+
cwd: ROOT,
|
|
162
|
+
encoding: "utf8",
|
|
163
|
+
});
|
|
164
|
+
return run.status === 0;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Every workspace package must have its published entry points built.
|
|
169
|
+
*
|
|
170
|
+
* An entry that points into `src/` is a defect: the build emits into
|
|
171
|
+
* `dist/`, so a `src/*.js` entry only exists when somebody compiled the
|
|
172
|
+
* package in place and would be missing from a clean checkout.
|
|
173
|
+
*/
|
|
174
|
+
function checkPackageEntries(): void {
|
|
175
|
+
const packagesDir = join(ROOT, "packages");
|
|
176
|
+
if (!existsSync(packagesDir)) return;
|
|
177
|
+
|
|
178
|
+
for (const entry of readdirSync(packagesDir)) {
|
|
179
|
+
const dir = join(packagesDir, entry);
|
|
180
|
+
if (!statSync(dir).isDirectory()) continue;
|
|
181
|
+
const manifestPath = join(dir, "package.json");
|
|
182
|
+
if (!existsSync(manifestPath)) continue;
|
|
183
|
+
|
|
184
|
+
let manifest: { main?: string; exports?: unknown; bin?: unknown };
|
|
185
|
+
try {
|
|
186
|
+
manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
187
|
+
} catch {
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
for (const target of manifestEntries(manifest)) {
|
|
192
|
+
const full = join(dir, target);
|
|
193
|
+
if (!existsSync(full)) {
|
|
194
|
+
problems.push({
|
|
195
|
+
kind: "missing-package",
|
|
196
|
+
detail: `packages/${entry} publishes ${target} but the file is not built`,
|
|
197
|
+
});
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
if (target.startsWith("./src/") && target.endsWith(".js")) {
|
|
201
|
+
// A package without any TypeScript source is vendored as
|
|
202
|
+
// compiled JavaScript (the telegram app). Its entry point
|
|
203
|
+
// stays in src/ - but the file must be tracked, otherwise a
|
|
204
|
+
// clean checkout publishes a package without its entry point.
|
|
205
|
+
const hasTypeScript = listFiles(join(dir, "src"), (file) =>
|
|
206
|
+
file.endsWith(".ts") && !file.endsWith(".d.ts"),
|
|
207
|
+
).length > 0;
|
|
208
|
+
const tracked = isTracked(join(dir, target));
|
|
209
|
+
if (hasTypeScript) {
|
|
210
|
+
problems.push({
|
|
211
|
+
kind: "missing-package",
|
|
212
|
+
detail: `packages/${entry} publishes ${target} from src/ - point it at the built dist/ file`,
|
|
213
|
+
});
|
|
214
|
+
} else if (!tracked) {
|
|
215
|
+
problems.push({
|
|
216
|
+
kind: "missing-package",
|
|
217
|
+
detail: `packages/${entry} publishes ${target} from src/ but the file is not tracked by git`,
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* A built output that is older than its source is stale.
|
|
227
|
+
*
|
|
228
|
+
* The release publishes the compiled `dist/`, so a dist that is older than the
|
|
229
|
+
* source it was compiled from ships yesterday's code. The build clears the
|
|
230
|
+
* incremental state before it compiles, so a fresh build is never stale.
|
|
231
|
+
*/
|
|
232
|
+
function checkStaleOutputs(): void {
|
|
233
|
+
const packagesDir = join(ROOT, "packages");
|
|
234
|
+
if (!existsSync(packagesDir)) return;
|
|
235
|
+
|
|
236
|
+
for (const entry of readdirSync(packagesDir)) {
|
|
237
|
+
const dir = join(packagesDir, entry);
|
|
238
|
+
if (!statSync(dir).isDirectory()) continue;
|
|
239
|
+
if (!existsSync(join(dir, "tsconfig.json"))) continue;
|
|
240
|
+
if (!existsSync(join(dir, "dist"))) continue;
|
|
241
|
+
|
|
242
|
+
const sources = listFiles(dir, (file) => {
|
|
243
|
+
if (!file.endsWith(".ts") || file.endsWith(".d.ts")) return false;
|
|
244
|
+
const rel = relative(dir, file).split("\\").join("/");
|
|
245
|
+
if (rel.startsWith("dist/") || rel.startsWith("node_modules/")) return false;
|
|
246
|
+
// Test sources are not part of the published build.
|
|
247
|
+
return !/^(test|tests|__tests__)\//.test(rel);
|
|
248
|
+
});
|
|
249
|
+
const outputs = listFiles(join(dir, "dist"), (file) => file.endsWith(".js"));
|
|
250
|
+
if (sources.length === 0 || outputs.length === 0) continue;
|
|
251
|
+
|
|
252
|
+
const newestSource = Math.max(...sources.map((file) => statSync(file).mtimeMs));
|
|
253
|
+
const oldestOutput = Math.min(...outputs.map((file) => statSync(file).mtimeMs));
|
|
254
|
+
if (newestSource > oldestOutput + 1_000) {
|
|
255
|
+
const newest = sources
|
|
256
|
+
.map((file) => ({ file, mtime: statSync(file).mtimeMs }))
|
|
257
|
+
.sort((a, b) => b.mtime - a.mtime)[0];
|
|
258
|
+
problems.push({
|
|
259
|
+
kind: "missing-dist",
|
|
260
|
+
detail: `packages/${entry} has a stale build - ${relative(
|
|
261
|
+
ROOT,
|
|
262
|
+
newest.file,
|
|
263
|
+
)} is newer than the compiled output. Run "bun run build".`,
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/** The tarball npm would publish must contain the built output. */
|
|
270
|
+
async function inspectTarball(): Promise<void> {
|
|
271
|
+
const stdout = await new Promise<string>((resolveText, rejectText) => {
|
|
272
|
+
execFile(
|
|
273
|
+
"npm",
|
|
274
|
+
["pack", "--dry-run", "--json", "--ignore-scripts"],
|
|
275
|
+
{ cwd: ROOT, maxBuffer: 64 * 1024 * 1024 },
|
|
276
|
+
(error, out, err) => {
|
|
277
|
+
if (error) {
|
|
278
|
+
rejectText(new Error(`${error.message}: ${String(err).slice(0, 400)}`));
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
resolveText(out);
|
|
282
|
+
},
|
|
283
|
+
);
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
let files: string[] = [];
|
|
287
|
+
try {
|
|
288
|
+
// `npm pack --json` returns an array with one entry per packed tarball.
|
|
289
|
+
const parsed = JSON.parse(stdout) as
|
|
290
|
+
| { files?: { path: string }[] }[]
|
|
291
|
+
| { files?: { path: string }[] };
|
|
292
|
+
const entries = Array.isArray(parsed) ? parsed : [parsed];
|
|
293
|
+
files = entries.flatMap((entry) => entry?.files ?? []).map((file) => file.path);
|
|
294
|
+
if (files.length === 0) {
|
|
295
|
+
problems.push({
|
|
296
|
+
kind: "missing-tarball",
|
|
297
|
+
detail: "npm pack --dry-run did not return a file list",
|
|
298
|
+
});
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
} catch {
|
|
302
|
+
problems.push({
|
|
303
|
+
kind: "missing-tarball",
|
|
304
|
+
detail: "npm pack --dry-run did not return a file list",
|
|
305
|
+
});
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
const inTarball = new Set(files);
|
|
310
|
+
for (const { file, specifier, target } of runtimeImports.values()) {
|
|
311
|
+
const relativeTarget = relative(ROOT, target).split("\\").join("/");
|
|
312
|
+
if (!inTarball.has(relativeTarget)) {
|
|
313
|
+
problems.push({
|
|
314
|
+
kind: "missing-tarball",
|
|
315
|
+
detail: `${relativeTarget} (imported by ${relative(
|
|
316
|
+
ROOT,
|
|
317
|
+
file,
|
|
318
|
+
)} as ${specifier}) is not in the tarball`,
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
checkImports();
|
|
325
|
+
checkPackageEntries();
|
|
326
|
+
checkStaleOutputs();
|
|
327
|
+
if (verifyTarball) await inspectTarball();
|
|
328
|
+
|
|
329
|
+
if (problems.length > 0) {
|
|
330
|
+
console.error(`[verify-package-contents] FAILED with ${problems.length} problem(s):`);
|
|
331
|
+
for (const problem of problems) {
|
|
332
|
+
console.error(` - [${problem.kind}] ${problem.detail}`);
|
|
333
|
+
}
|
|
334
|
+
console.error(
|
|
335
|
+
"",
|
|
336
|
+
"Every internal package must ship inside pi-harness-runtime. Run `bun run build` and check the tsc output before publishing.",
|
|
337
|
+
);
|
|
338
|
+
process.exit(1);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
console.log(
|
|
342
|
+
`[verify-package-contents] OK - ${runtimeImports.size} runtime import(s) resolved${
|
|
343
|
+
verifyTarball ? ", tarball verified" : ""
|
|
344
|
+
}`,
|
|
345
|
+
);
|
package/scripts/ws-server.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* Telegram/LINE → Webhook → This Server → WebSocket → Local Client
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { createRelayServer, type RelayServerOptions } from "../packages/relay/
|
|
15
|
+
import { createRelayServer, type RelayServerOptions } from "../packages/relay/dist/server.js";
|
|
16
16
|
|
|
17
17
|
// Configuration from environment
|
|
18
18
|
const PORT = parseInt(process.env.WS_PORT || "8444", 10);
|
package/tracker.ts
CHANGED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base Browser Scraper — Abstract class for browser-based quota scraping
|
|
3
|
-
*
|
|
4
|
-
* Uses Playwright with Chrome profiles to scrape JavaScript-rendered pages
|
|
5
|
-
* that require authentication. Similar approach to google-flow-mcp.
|
|
6
|
-
*/
|
|
7
|
-
import type { Page, Browser, BrowserContext } from "playwright";
|
|
8
|
-
export interface BrowserScraperConfig {
|
|
9
|
-
/** Headless mode (default: true) */
|
|
10
|
-
headless?: boolean;
|
|
11
|
-
/** Page load timeout in ms (default: 30000) */
|
|
12
|
-
timeout?: number;
|
|
13
|
-
/** Viewport dimensions */
|
|
14
|
-
viewport?: {
|
|
15
|
-
width: number;
|
|
16
|
-
height: number;
|
|
17
|
-
};
|
|
18
|
-
/** Slow down operations by ms (for debugging) */
|
|
19
|
-
slowMo?: number;
|
|
20
|
-
/** Provider name for logging */
|
|
21
|
-
provider: string;
|
|
22
|
-
/** URL to scrape */
|
|
23
|
-
url: string;
|
|
24
|
-
}
|
|
25
|
-
export interface QuotaScrapingResult<T> {
|
|
26
|
-
/** Whether scraping was successful */
|
|
27
|
-
success: boolean;
|
|
28
|
-
/** The scraped data */
|
|
29
|
-
data?: T;
|
|
30
|
-
/** Error message if failed */
|
|
31
|
-
error?: string;
|
|
32
|
-
/** Timestamp of scrape */
|
|
33
|
-
scrapedAt: string;
|
|
34
|
-
/** Screenshot path if debug screenshot was taken */
|
|
35
|
-
screenshotPath?: string;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Abstract base class for browser-based quota scrapers
|
|
39
|
-
*/
|
|
40
|
-
export declare abstract class BaseBrowserScraper<T> {
|
|
41
|
-
protected config: Required<BrowserScraperConfig>;
|
|
42
|
-
protected browser: Browser | null;
|
|
43
|
-
protected context: BrowserContext | null;
|
|
44
|
-
protected page: Page | null;
|
|
45
|
-
protected screenshotsEnabled: boolean;
|
|
46
|
-
protected screenshotsDir: string;
|
|
47
|
-
constructor(config: BrowserScraperConfig);
|
|
48
|
-
/**
|
|
49
|
-
* Initialize Playwright and launch browser
|
|
50
|
-
*/
|
|
51
|
-
protected abstract createBrowser(): Promise<void>;
|
|
52
|
-
/**
|
|
53
|
-
* Take a debug screenshot
|
|
54
|
-
*/
|
|
55
|
-
takeScreenshot(name: string): Promise<string | undefined>;
|
|
56
|
-
/**
|
|
57
|
-
* Wait for a selector with retry logic
|
|
58
|
-
*/
|
|
59
|
-
protected waitForSelector(selector: string, options?: {
|
|
60
|
-
timeout?: number;
|
|
61
|
-
state?: "attached" | "detached" | "visible" | "hidden";
|
|
62
|
-
}): Promise<boolean>;
|
|
63
|
-
/**
|
|
64
|
-
* Extract text content from page
|
|
65
|
-
*/
|
|
66
|
-
protected extractText(selector: string): Promise<string | null>;
|
|
67
|
-
/**
|
|
68
|
-
* Extract number from text (handles various formats like "1.5 GB", "$10.00", etc.)
|
|
69
|
-
*/
|
|
70
|
-
protected extractNumber(text: string | null, pattern?: RegExp): number | null;
|
|
71
|
-
/**
|
|
72
|
-
* Main scraping method — navigates and extracts data
|
|
73
|
-
*/
|
|
74
|
-
scrape(): Promise<QuotaScrapingResult<T>>;
|
|
75
|
-
/**
|
|
76
|
-
* Check if current page is a login page
|
|
77
|
-
*/
|
|
78
|
-
protected abstract isLoginPage(): Promise<boolean>;
|
|
79
|
-
/**
|
|
80
|
-
* Extract quota data from the page
|
|
81
|
-
*/
|
|
82
|
-
protected abstract extractData(): Promise<T | null>;
|
|
83
|
-
/**
|
|
84
|
-
* Cleanup browser resources
|
|
85
|
-
*/
|
|
86
|
-
cleanup(): Promise<void>;
|
|
87
|
-
/**
|
|
88
|
-
* Enable screenshot capture for debugging
|
|
89
|
-
*/
|
|
90
|
-
enableScreenshots(dir?: string): void;
|
|
91
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Chrome Profile Manager — Browser-based quota scraping via Playwright
|
|
3
|
-
*
|
|
4
|
-
* Key concepts from google-flow-mcp:
|
|
5
|
-
* - Uses Playwright to connect to existing Chrome profile with stored cookies
|
|
6
|
-
* - Maintains persistent session across runs
|
|
7
|
-
* - Bypasses anti-bot measures by launching Chrome directly
|
|
8
|
-
*
|
|
9
|
-
* This enables scraping JavaScript-rendered pages that require authentication:
|
|
10
|
-
* - chatgpt.com/codex/cloud/settings/analytics
|
|
11
|
-
* - z.ai/manage-apikey/coding-plan/personal/usage
|
|
12
|
-
* - etc.
|
|
13
|
-
*/
|
|
14
|
-
export interface ChromeProfileConfig {
|
|
15
|
-
/** Provider name (e.g., "codex", "z-ai") */
|
|
16
|
-
provider: string;
|
|
17
|
-
/** Path to Chrome user data directory (auto-detected if not provided) */
|
|
18
|
-
userDataDir?: string;
|
|
19
|
-
/** Profile directory name within userDataDir */
|
|
20
|
-
profileName?: string;
|
|
21
|
-
/** Path to browser binary (auto-detected if not provided) */
|
|
22
|
-
binaryPath?: string;
|
|
23
|
-
/** Arguments to pass to Chrome */
|
|
24
|
-
extraArgs?: string[];
|
|
25
|
-
/** Headless mode (default: true for scraping) */
|
|
26
|
-
headless?: boolean;
|
|
27
|
-
/** Launch timeout in ms */
|
|
28
|
-
launchTimeout?: number;
|
|
29
|
-
}
|
|
30
|
-
export interface BrowserProfile {
|
|
31
|
-
/** Path to the profile directory */
|
|
32
|
-
profilePath: string;
|
|
33
|
-
/** Provider name */
|
|
34
|
-
provider: string;
|
|
35
|
-
/** Whether the profile exists */
|
|
36
|
-
exists: boolean;
|
|
37
|
-
/** Last used timestamp */
|
|
38
|
-
lastUsed?: number;
|
|
39
|
-
}
|
|
40
|
-
/** Auto-detect Chrome user data directory based on OS */
|
|
41
|
-
export declare function detectChromeUserDataDir(): string | null;
|
|
42
|
-
/** Auto-detect Chrome binary path */
|
|
43
|
-
export declare function detectChromeBinary(): string | null;
|
|
44
|
-
/**
|
|
45
|
-
* Chrome Profile Manager for browser-based scraping
|
|
46
|
-
*
|
|
47
|
-
* Manages Chrome profiles for different providers to maintain
|
|
48
|
-
* authenticated sessions across scraping runs.
|
|
49
|
-
*/
|
|
50
|
-
export declare class ChromeProfileManager {
|
|
51
|
-
private profilesDir;
|
|
52
|
-
private profiles;
|
|
53
|
-
constructor(profilesDir?: string);
|
|
54
|
-
private ensureProfilesDir;
|
|
55
|
-
private getProfileMetaPath;
|
|
56
|
-
private loadProfiles;
|
|
57
|
-
/**
|
|
58
|
-
* Get profile path for a provider
|
|
59
|
-
*/
|
|
60
|
-
getProfilePath(provider: string): string;
|
|
61
|
-
/**
|
|
62
|
-
* Ensure profile directory exists
|
|
63
|
-
*/
|
|
64
|
-
ensureProfile(provider: string): BrowserProfile;
|
|
65
|
-
private saveProfileMeta;
|
|
66
|
-
/**
|
|
67
|
-
* List all managed profiles
|
|
68
|
-
*/
|
|
69
|
-
listProfiles(): BrowserProfile[];
|
|
70
|
-
/**
|
|
71
|
-
* Delete a profile
|
|
72
|
-
*/
|
|
73
|
-
deleteProfile(provider: string): Promise<void>;
|
|
74
|
-
/**
|
|
75
|
-
* Get Chrome launch arguments for anti-bot evasion
|
|
76
|
-
* Based on google-flow-mcp approach
|
|
77
|
-
*/
|
|
78
|
-
getLaunchArgs(config: ChromeProfileConfig): string[];
|
|
79
|
-
}
|
|
80
|
-
export declare function getChromeProfileManager(): ChromeProfileManager;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Codex Browser Scraper — Scrapes chatgpt.com/codex/cloud/settings/analytics
|
|
3
|
-
*
|
|
4
|
-
* Uses Playwright with Chrome profile to access the authenticated page
|
|
5
|
-
* and extract usage/quota data.
|
|
6
|
-
*/
|
|
7
|
-
import { BaseBrowserScraper } from "./base-browser-scraper.js";
|
|
8
|
-
export interface CodexQuotaData {
|
|
9
|
-
provider: "openai-codex";
|
|
10
|
-
/** Plan type (e.g., "pro", "plus") */
|
|
11
|
-
planType?: string;
|
|
12
|
-
/** Current usage percentage (0-100) */
|
|
13
|
-
usagePercent: number;
|
|
14
|
-
/** Total quota amount */
|
|
15
|
-
totalQuota?: string;
|
|
16
|
-
/** Used quota amount */
|
|
17
|
-
usedQuota?: string;
|
|
18
|
-
/** Remaining quota */
|
|
19
|
-
remainingQuota?: string;
|
|
20
|
-
/** Reset date/time */
|
|
21
|
-
resetAt?: string;
|
|
22
|
-
/** Usage period description */
|
|
23
|
-
period?: string;
|
|
24
|
-
/** Raw data for debugging */
|
|
25
|
-
rawData?: Record<string, unknown>;
|
|
26
|
-
/** Timestamp */
|
|
27
|
-
scrapedAt: string;
|
|
28
|
-
}
|
|
29
|
-
interface CodexScraperConfig {
|
|
30
|
-
provider?: string;
|
|
31
|
-
url?: string;
|
|
32
|
-
headless?: boolean;
|
|
33
|
-
timeout?: number;
|
|
34
|
-
viewport?: {
|
|
35
|
-
width: number;
|
|
36
|
-
height: number;
|
|
37
|
-
};
|
|
38
|
-
slowMo?: number;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Codex Browser Scraper
|
|
42
|
-
*
|
|
43
|
-
* Scrapes usage data from chatgpt.com/codex/cloud/settings/analytics
|
|
44
|
-
*/
|
|
45
|
-
export declare class CodexBrowserScraper extends BaseBrowserScraper<CodexQuotaData> {
|
|
46
|
-
constructor(config?: Partial<CodexScraperConfig>);
|
|
47
|
-
protected createBrowser(): Promise<void>;
|
|
48
|
-
private getProfileDir;
|
|
49
|
-
protected isLoginPage(): Promise<boolean>;
|
|
50
|
-
protected extractData(): Promise<CodexQuotaData | null>;
|
|
51
|
-
private extractUsageData;
|
|
52
|
-
private extractAdditionalData;
|
|
53
|
-
private extractFromHeadings;
|
|
54
|
-
private extractChartData;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Quick scrape function
|
|
58
|
-
*/
|
|
59
|
-
export declare function scrapeCodexQuota(): Promise<CodexQuotaData | null>;
|
|
60
|
-
export {};
|