@liangjie559567/ultrapower 5.5.12 → 5.5.13
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +2 -2
- package/LICENSE +21 -21
- package/bridge/gyoshu_bridge.py +846 -846
- package/bridge/mcp-server.cjs +145 -38
- package/commands/wizard.md +5 -0
- package/dist/agents/__tests__/agent-wrapper.test.d.ts +2 -0
- package/dist/agents/__tests__/agent-wrapper.test.d.ts.map +1 -0
- package/dist/agents/__tests__/agent-wrapper.test.js +37 -0
- package/dist/agents/__tests__/agent-wrapper.test.js.map +1 -0
- package/dist/agents/__tests__/timeout-config.test.d.ts +2 -0
- package/dist/agents/__tests__/timeout-config.test.d.ts.map +1 -0
- package/dist/agents/__tests__/timeout-config.test.js +35 -0
- package/dist/agents/__tests__/timeout-config.test.js.map +1 -0
- package/dist/agents/__tests__/timeout-manager.test.d.ts +2 -0
- package/dist/agents/__tests__/timeout-manager.test.d.ts.map +1 -0
- package/dist/agents/__tests__/timeout-manager.test.js +37 -0
- package/dist/agents/__tests__/timeout-manager.test.js.map +1 -0
- package/dist/agents/agent-wrapper.d.ts +22 -0
- package/dist/agents/agent-wrapper.d.ts.map +1 -0
- package/dist/agents/agent-wrapper.js +51 -0
- package/dist/agents/agent-wrapper.js.map +1 -0
- package/dist/agents/coordinator-deprecated.d.ts +18 -0
- package/dist/agents/coordinator-deprecated.d.ts.map +1 -0
- package/dist/agents/coordinator-deprecated.js +38 -0
- package/dist/agents/coordinator-deprecated.js.map +1 -0
- package/dist/agents/index.d.ts +3 -0
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +4 -0
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/timeout-config.d.ts +19 -0
- package/dist/agents/timeout-config.d.ts.map +1 -0
- package/dist/agents/timeout-config.js +57 -0
- package/dist/agents/timeout-config.js.map +1 -0
- package/dist/agents/timeout-manager.d.ts +30 -0
- package/dist/agents/timeout-manager.d.ts.map +1 -0
- package/dist/agents/timeout-manager.js +47 -0
- package/dist/agents/timeout-manager.js.map +1 -0
- package/dist/analytics/analytics-summary.d.ts.map +1 -1
- package/dist/analytics/analytics-summary.js +7 -1
- package/dist/analytics/analytics-summary.js.map +1 -1
- package/dist/analytics/metrics-collector.d.ts.map +1 -1
- package/dist/analytics/metrics-collector.js +9 -1
- package/dist/analytics/metrics-collector.js.map +1 -1
- package/dist/analytics/query-engine.d.ts.map +1 -1
- package/dist/analytics/query-engine.js +21 -3
- package/dist/analytics/query-engine.js.map +1 -1
- package/dist/analytics/token-tracker.js +3 -3
- package/dist/analytics/token-tracker.js.map +1 -1
- package/dist/analytics/transcript-scanner.d.ts.map +1 -1
- package/dist/analytics/transcript-scanner.js +1 -0
- package/dist/analytics/transcript-scanner.js.map +1 -1
- package/dist/audit/logger.d.ts +28 -0
- package/dist/audit/logger.d.ts.map +1 -0
- package/dist/audit/logger.js +78 -0
- package/dist/audit/logger.js.map +1 -0
- package/dist/audit/verify-cli.d.ts +2 -0
- package/dist/audit/verify-cli.d.ts.map +1 -0
- package/dist/audit/verify-cli.js +10 -0
- package/dist/audit/verify-cli.js.map +1 -0
- package/dist/core/hud-config.d.ts +19 -0
- package/dist/core/hud-config.d.ts.map +1 -0
- package/dist/core/hud-config.js +6 -0
- package/dist/core/hud-config.js.map +1 -0
- package/dist/core/job-types.d.ts +22 -0
- package/dist/core/job-types.d.ts.map +1 -0
- package/dist/core/job-types.js +6 -0
- package/dist/core/job-types.js.map +1 -0
- package/dist/features/diagnostics/error-matcher.d.ts +12 -0
- package/dist/features/diagnostics/error-matcher.d.ts.map +1 -0
- package/dist/features/diagnostics/error-matcher.js +41 -0
- package/dist/features/diagnostics/error-matcher.js.map +1 -0
- package/dist/features/diagnostics/index.d.ts +3 -0
- package/dist/features/diagnostics/index.d.ts.map +1 -0
- package/dist/features/diagnostics/index.js +3 -0
- package/dist/features/diagnostics/index.js.map +1 -0
- package/dist/features/diagnostics/solution-suggester.d.ts +12 -0
- package/dist/features/diagnostics/solution-suggester.d.ts.map +1 -0
- package/dist/features/diagnostics/solution-suggester.js +46 -0
- package/dist/features/diagnostics/solution-suggester.js.map +1 -0
- package/dist/features/diagnostics/types.d.ts +25 -0
- package/dist/features/diagnostics/types.d.ts.map +1 -0
- package/dist/features/diagnostics/types.js +5 -0
- package/dist/features/diagnostics/types.js.map +1 -0
- package/dist/features/state-manager/__tests__/cache.test.js +17 -17
- package/dist/features/state-manager/__tests__/cache.test.js.map +1 -1
- package/dist/features/state-manager/__tests__/encryption-performance.test.d.ts +2 -0
- package/dist/features/state-manager/__tests__/encryption-performance.test.d.ts.map +1 -0
- package/dist/features/state-manager/__tests__/encryption-performance.test.js +42 -0
- package/dist/features/state-manager/__tests__/encryption-performance.test.js.map +1 -0
- package/dist/features/state-manager/__tests__/encryption.test.d.ts +2 -0
- package/dist/features/state-manager/__tests__/encryption.test.d.ts.map +1 -0
- package/dist/features/state-manager/__tests__/encryption.test.js +68 -0
- package/dist/features/state-manager/__tests__/encryption.test.js.map +1 -0
- package/dist/features/state-manager/encryption.d.ts +24 -0
- package/dist/features/state-manager/encryption.d.ts.map +1 -0
- package/dist/features/state-manager/encryption.js +86 -0
- package/dist/features/state-manager/encryption.js.map +1 -0
- package/dist/features/state-manager/index.d.ts +4 -0
- package/dist/features/state-manager/index.d.ts.map +1 -1
- package/dist/features/state-manager/index.js +94 -6
- package/dist/features/state-manager/index.js.map +1 -1
- package/dist/features/state-manager/tiered-writer.d.ts +44 -0
- package/dist/features/state-manager/tiered-writer.d.ts.map +1 -0
- package/dist/features/state-manager/tiered-writer.js +76 -0
- package/dist/features/state-manager/tiered-writer.js.map +1 -0
- package/dist/features/state-manager/wal.d.ts +21 -0
- package/dist/features/state-manager/wal.d.ts.map +1 -0
- package/dist/features/state-manager/wal.js +75 -0
- package/dist/features/state-manager/wal.js.map +1 -0
- package/dist/features/task-templates/index.d.ts +13 -0
- package/dist/features/task-templates/index.d.ts.map +1 -0
- package/dist/features/task-templates/index.js +31 -0
- package/dist/features/task-templates/index.js.map +1 -0
- package/dist/features/task-templates/wizard-integration.d.ts +15 -0
- package/dist/features/task-templates/wizard-integration.d.ts.map +1 -0
- package/dist/features/task-templates/wizard-integration.js +27 -0
- package/dist/features/task-templates/wizard-integration.js.map +1 -0
- package/dist/features/wizard/__tests__/engine.test.d.ts +2 -0
- package/dist/features/wizard/__tests__/engine.test.d.ts.map +1 -0
- package/dist/features/wizard/__tests__/engine.test.js +78 -0
- package/dist/features/wizard/__tests__/engine.test.js.map +1 -0
- package/dist/features/wizard/__tests__/recommendation-engine.test.d.ts +2 -0
- package/dist/features/wizard/__tests__/recommendation-engine.test.d.ts.map +1 -0
- package/dist/features/wizard/__tests__/recommendation-engine.test.js +43 -0
- package/dist/features/wizard/__tests__/recommendation-engine.test.js.map +1 -0
- package/dist/features/wizard/engine.d.ts +15 -0
- package/dist/features/wizard/engine.d.ts.map +1 -0
- package/dist/features/wizard/engine.js +74 -0
- package/dist/features/wizard/engine.js.map +1 -0
- package/dist/features/wizard/index.d.ts +8 -0
- package/dist/features/wizard/index.d.ts.map +1 -0
- package/dist/features/wizard/index.js +7 -0
- package/dist/features/wizard/index.js.map +1 -0
- package/dist/features/wizard/questions.d.ts +6 -0
- package/dist/features/wizard/questions.d.ts.map +1 -0
- package/dist/features/wizard/questions.js +64 -0
- package/dist/features/wizard/questions.js.map +1 -0
- package/dist/features/wizard/recommendation-engine.d.ts +6 -0
- package/dist/features/wizard/recommendation-engine.d.ts.map +1 -0
- package/dist/features/wizard/recommendation-engine.js +33 -0
- package/dist/features/wizard/recommendation-engine.js.map +1 -0
- package/dist/features/wizard/types.d.ts +23 -0
- package/dist/features/wizard/types.d.ts.map +1 -0
- package/dist/features/wizard/types.js +5 -0
- package/dist/features/wizard/types.js.map +1 -0
- package/dist/features/workflow-recommender/context-analyzer.d.ts +6 -0
- package/dist/features/workflow-recommender/context-analyzer.d.ts.map +1 -0
- package/dist/features/workflow-recommender/context-analyzer.js +20 -0
- package/dist/features/workflow-recommender/context-analyzer.js.map +1 -0
- package/dist/features/workflow-recommender/index.d.ts +8 -0
- package/dist/features/workflow-recommender/index.d.ts.map +1 -0
- package/dist/features/workflow-recommender/index.js +7 -0
- package/dist/features/workflow-recommender/index.js.map +1 -0
- package/dist/features/workflow-recommender/intent-classifier.d.ts +6 -0
- package/dist/features/workflow-recommender/intent-classifier.d.ts.map +1 -0
- package/dist/features/workflow-recommender/intent-classifier.js +24 -0
- package/dist/features/workflow-recommender/intent-classifier.js.map +1 -0
- package/dist/features/workflow-recommender/recommendation-engine.d.ts +6 -0
- package/dist/features/workflow-recommender/recommendation-engine.d.ts.map +1 -0
- package/dist/features/workflow-recommender/recommendation-engine.js +110 -0
- package/dist/features/workflow-recommender/recommendation-engine.js.map +1 -0
- package/dist/features/workflow-recommender/types.d.ts +20 -0
- package/dist/features/workflow-recommender/types.d.ts.map +1 -0
- package/dist/features/workflow-recommender/types.js +5 -0
- package/dist/features/workflow-recommender/types.js.map +1 -0
- package/dist/hooks/__tests__/bridge-normalize.test.d.ts +2 -0
- package/dist/hooks/__tests__/bridge-normalize.test.d.ts.map +1 -0
- package/dist/hooks/__tests__/bridge-normalize.test.js +90 -0
- package/dist/hooks/__tests__/bridge-normalize.test.js.map +1 -0
- package/dist/hooks/__tests__/bridge-security.test.js +23 -41
- package/dist/hooks/__tests__/bridge-security.test.js.map +1 -1
- package/dist/hooks/auto-slash-command/__tests__/detector.test.d.ts +2 -0
- package/dist/hooks/auto-slash-command/__tests__/detector.test.d.ts.map +1 -0
- package/dist/hooks/auto-slash-command/__tests__/detector.test.js +70 -0
- package/dist/hooks/auto-slash-command/__tests__/detector.test.js.map +1 -0
- package/dist/hooks/auto-slash-command/__tests__/executor.test.d.ts +2 -0
- package/dist/hooks/auto-slash-command/__tests__/executor.test.d.ts.map +1 -0
- package/dist/hooks/auto-slash-command/__tests__/executor.test.js +55 -0
- package/dist/hooks/auto-slash-command/__tests__/executor.test.js.map +1 -0
- package/dist/hooks/auto-slash-command/__tests__/index.test.d.ts +2 -0
- package/dist/hooks/auto-slash-command/__tests__/index.test.d.ts.map +1 -0
- package/dist/hooks/auto-slash-command/__tests__/index.test.js +50 -0
- package/dist/hooks/auto-slash-command/__tests__/index.test.js.map +1 -0
- package/dist/hooks/autopilot/__tests__/prompts.test.js +19 -1
- package/dist/hooks/autopilot/__tests__/prompts.test.js.map +1 -1
- package/dist/hooks/autopilot/enforcement.d.ts +1 -1
- package/dist/hooks/autopilot/enforcement.d.ts.map +1 -1
- package/dist/hooks/autopilot/enforcement.js +1 -1
- package/dist/hooks/autopilot/enforcement.js.map +1 -1
- package/dist/hooks/bridge-normalize.d.ts +43 -3
- package/dist/hooks/bridge-normalize.d.ts.map +1 -1
- package/dist/hooks/bridge-normalize.js +110 -15
- package/dist/hooks/bridge-normalize.js.map +1 -1
- package/dist/hooks/bridge-types.d.ts +48 -0
- package/dist/hooks/bridge-types.d.ts.map +1 -0
- package/dist/hooks/bridge-types.js +6 -0
- package/dist/hooks/bridge-types.js.map +1 -0
- package/dist/hooks/bridge.d.ts +1 -43
- package/dist/hooks/bridge.d.ts.map +1 -1
- package/dist/hooks/bridge.js +18 -2
- package/dist/hooks/bridge.js.map +1 -1
- package/dist/hooks/dependency-analyzer.d.ts +32 -0
- package/dist/hooks/dependency-analyzer.d.ts.map +1 -0
- package/dist/hooks/dependency-analyzer.js +199 -0
- package/dist/hooks/dependency-analyzer.js.map +1 -0
- package/dist/hooks/index.d.ts +2 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/learner/__tests__/detector.test.d.ts +2 -0
- package/dist/hooks/learner/__tests__/detector.test.d.ts.map +1 -0
- package/dist/hooks/learner/__tests__/detector.test.js +170 -0
- package/dist/hooks/learner/__tests__/detector.test.js.map +1 -0
- package/dist/hooks/learner/__tests__/index.test.d.ts +2 -0
- package/dist/hooks/learner/__tests__/index.test.d.ts.map +1 -0
- package/dist/hooks/learner/__tests__/index.test.js +48 -0
- package/dist/hooks/learner/__tests__/index.test.js.map +1 -0
- package/dist/hooks/learner/__tests__/matcher.test.d.ts +2 -0
- package/dist/hooks/learner/__tests__/matcher.test.d.ts.map +1 -0
- package/dist/hooks/learner/__tests__/matcher.test.js +114 -0
- package/dist/hooks/learner/__tests__/matcher.test.js.map +1 -0
- package/dist/hooks/learner/__tests__/promotion.test.d.ts +2 -0
- package/dist/hooks/learner/__tests__/promotion.test.d.ts.map +1 -0
- package/dist/hooks/learner/__tests__/promotion.test.js +146 -0
- package/dist/hooks/learner/__tests__/promotion.test.js.map +1 -0
- package/dist/hooks/learner/__tests__/validator.test.d.ts +2 -0
- package/dist/hooks/learner/__tests__/validator.test.d.ts.map +1 -0
- package/dist/hooks/learner/__tests__/validator.test.js +123 -0
- package/dist/hooks/learner/__tests__/validator.test.js.map +1 -0
- package/dist/hooks/learner/__tests__/writer.test.d.ts +2 -0
- package/dist/hooks/learner/__tests__/writer.test.d.ts.map +1 -0
- package/dist/hooks/learner/__tests__/writer.test.js +141 -0
- package/dist/hooks/learner/__tests__/writer.test.js.map +1 -0
- package/dist/hooks/learner/detection-hook.js +2 -2
- package/dist/hooks/learner/detection-hook.js.map +1 -1
- package/dist/hooks/parallel-executor.d.ts +24 -0
- package/dist/hooks/parallel-executor.d.ts.map +1 -0
- package/dist/hooks/parallel-executor.js +82 -0
- package/dist/hooks/parallel-executor.js.map +1 -0
- package/dist/hooks/persistent-mode/index.d.ts +2 -21
- package/dist/hooks/persistent-mode/index.d.ts.map +1 -1
- package/dist/hooks/persistent-mode/index.js +4 -85
- package/dist/hooks/persistent-mode/index.js.map +1 -1
- package/dist/hooks/persistent-mode/tool-error.d.ts +15 -0
- package/dist/hooks/persistent-mode/tool-error.d.ts.map +1 -0
- package/dist/hooks/persistent-mode/tool-error.js +80 -0
- package/dist/hooks/persistent-mode/tool-error.js.map +1 -0
- package/dist/hooks/pre-compact/index.d.ts.map +1 -1
- package/dist/hooks/pre-compact/index.js +0 -1
- package/dist/hooks/pre-compact/index.js.map +1 -1
- package/dist/hooks/project-memory/learner.d.ts +13 -1
- package/dist/hooks/project-memory/learner.d.ts.map +1 -1
- package/dist/hooks/project-memory/learner.js +24 -12
- package/dist/hooks/project-memory/learner.js.map +1 -1
- package/dist/hooks/race-detector.d.ts +51 -0
- package/dist/hooks/race-detector.d.ts.map +1 -0
- package/dist/hooks/race-detector.js +121 -0
- package/dist/hooks/race-detector.js.map +1 -0
- package/dist/hooks/ralph/__tests__/loop.test.d.ts +2 -0
- package/dist/hooks/ralph/__tests__/loop.test.d.ts.map +1 -0
- package/dist/hooks/ralph/__tests__/loop.test.js +268 -0
- package/dist/hooks/ralph/__tests__/loop.test.js.map +1 -0
- package/dist/hooks/ralph/__tests__/prd.test.d.ts +2 -0
- package/dist/hooks/ralph/__tests__/prd.test.d.ts.map +1 -0
- package/dist/hooks/ralph/__tests__/prd.test.js +197 -0
- package/dist/hooks/ralph/__tests__/prd.test.js.map +1 -0
- package/dist/hooks/ralph/__tests__/progress.test.d.ts +2 -0
- package/dist/hooks/ralph/__tests__/progress.test.d.ts.map +1 -0
- package/dist/hooks/ralph/__tests__/progress.test.js +120 -0
- package/dist/hooks/ralph/__tests__/progress.test.js.map +1 -0
- package/dist/hooks/ralph/__tests__/verifier.test.d.ts +2 -0
- package/dist/hooks/ralph/__tests__/verifier.test.d.ts.map +1 -0
- package/dist/hooks/ralph/__tests__/verifier.test.js +75 -0
- package/dist/hooks/ralph/__tests__/verifier.test.js.map +1 -0
- package/dist/hooks/recovery/__tests__/context-window.test.d.ts +2 -0
- package/dist/hooks/recovery/__tests__/context-window.test.d.ts.map +1 -0
- package/dist/hooks/recovery/__tests__/context-window.test.js +131 -0
- package/dist/hooks/recovery/__tests__/context-window.test.js.map +1 -0
- package/dist/hooks/recovery/__tests__/edit-error.test.d.ts +2 -0
- package/dist/hooks/recovery/__tests__/edit-error.test.d.ts.map +1 -0
- package/dist/hooks/recovery/__tests__/edit-error.test.js +88 -0
- package/dist/hooks/recovery/__tests__/edit-error.test.js.map +1 -0
- package/dist/hooks/recovery/__tests__/index.test.d.ts +2 -0
- package/dist/hooks/recovery/__tests__/index.test.d.ts.map +1 -0
- package/dist/hooks/recovery/__tests__/index.test.js +270 -0
- package/dist/hooks/recovery/__tests__/index.test.js.map +1 -0
- package/dist/hooks/recovery/__tests__/session-recovery.test.d.ts +2 -0
- package/dist/hooks/recovery/__tests__/session-recovery.test.d.ts.map +1 -0
- package/dist/hooks/recovery/__tests__/session-recovery.test.js +129 -0
- package/dist/hooks/recovery/__tests__/session-recovery.test.js.map +1 -0
- package/dist/hooks/recovery/__tests__/storage.test.d.ts +2 -0
- package/dist/hooks/recovery/__tests__/storage.test.d.ts.map +1 -0
- package/dist/hooks/recovery/__tests__/storage.test.js +549 -0
- package/dist/hooks/recovery/__tests__/storage.test.js.map +1 -0
- package/dist/hooks/rules-injector/__tests__/finder.test.d.ts +2 -0
- package/dist/hooks/rules-injector/__tests__/finder.test.d.ts.map +1 -0
- package/dist/hooks/rules-injector/__tests__/finder.test.js +68 -0
- package/dist/hooks/rules-injector/__tests__/finder.test.js.map +1 -0
- package/dist/hooks/rules-injector/__tests__/index.test.d.ts +2 -0
- package/dist/hooks/rules-injector/__tests__/index.test.d.ts.map +1 -0
- package/dist/hooks/rules-injector/__tests__/index.test.js +58 -0
- package/dist/hooks/rules-injector/__tests__/index.test.js.map +1 -0
- package/dist/hooks/rules-injector/__tests__/matcher.test.d.ts +2 -0
- package/dist/hooks/rules-injector/__tests__/matcher.test.d.ts.map +1 -0
- package/dist/hooks/rules-injector/__tests__/matcher.test.js +86 -0
- package/dist/hooks/rules-injector/__tests__/matcher.test.js.map +1 -0
- package/dist/hooks/rules-injector/__tests__/parser.test.d.ts +2 -0
- package/dist/hooks/rules-injector/__tests__/parser.test.d.ts.map +1 -0
- package/dist/hooks/rules-injector/__tests__/parser.test.js +86 -0
- package/dist/hooks/rules-injector/__tests__/parser.test.js.map +1 -0
- package/dist/hooks/session-end/__tests__/index.test.d.ts +2 -0
- package/dist/hooks/session-end/__tests__/index.test.d.ts.map +1 -0
- package/dist/hooks/session-end/__tests__/index.test.js +77 -0
- package/dist/hooks/session-end/__tests__/index.test.js.map +1 -0
- package/dist/hooks/session-end/callbacks.d.ts +1 -1
- package/dist/hooks/session-end/index.d.ts +2 -21
- package/dist/hooks/session-end/index.d.ts.map +1 -1
- package/dist/hooks/session-end/index.js.map +1 -1
- package/dist/hooks/session-end/types.d.ts +26 -0
- package/dist/hooks/session-end/types.d.ts.map +1 -0
- package/dist/hooks/session-end/types.js +6 -0
- package/dist/hooks/session-end/types.js.map +1 -0
- package/dist/hooks/setup/__tests__/index.test.d.ts +2 -0
- package/dist/hooks/setup/__tests__/index.test.d.ts.map +1 -0
- package/dist/hooks/setup/__tests__/index.test.js +68 -0
- package/dist/hooks/setup/__tests__/index.test.js.map +1 -0
- package/dist/hooks/team-pipeline/__tests__/state.test.d.ts +2 -0
- package/dist/hooks/team-pipeline/__tests__/state.test.d.ts.map +1 -0
- package/dist/hooks/team-pipeline/__tests__/state.test.js +94 -0
- package/dist/hooks/team-pipeline/__tests__/state.test.js.map +1 -0
- package/dist/hud/elements/autopilot.d.ts +1 -1
- package/dist/hud/elements/autopilot.d.ts.map +1 -1
- package/dist/hud/state.d.ts.map +1 -1
- package/dist/hud/state.js +69 -1
- package/dist/hud/state.js.map +1 -1
- package/dist/hud/types.d.ts +2 -15
- package/dist/hud/types.d.ts.map +1 -1
- package/dist/hud/types.js.map +1 -1
- package/dist/lib/__tests__/validateMode.test.d.ts +2 -0
- package/dist/lib/__tests__/validateMode.test.d.ts.map +1 -0
- package/dist/lib/__tests__/validateMode.test.js +61 -0
- package/dist/lib/__tests__/validateMode.test.js.map +1 -0
- package/dist/lib/path-validator.d.ts +25 -0
- package/dist/lib/path-validator.d.ts.map +1 -0
- package/dist/lib/path-validator.js +81 -0
- package/dist/lib/path-validator.js.map +1 -0
- package/dist/lib/validateMode.d.ts +3 -0
- package/dist/lib/validateMode.d.ts.map +1 -1
- package/dist/lib/validateMode.js +28 -2
- package/dist/lib/validateMode.js.map +1 -1
- package/dist/mcp/__tests__/codex-core.test.d.ts +2 -0
- package/dist/mcp/__tests__/codex-core.test.d.ts.map +1 -0
- package/dist/mcp/__tests__/codex-core.test.js +143 -0
- package/dist/mcp/__tests__/codex-core.test.js.map +1 -0
- package/dist/mcp/__tests__/gemini-core.test.d.ts +2 -0
- package/dist/mcp/__tests__/gemini-core.test.d.ts.map +1 -0
- package/dist/mcp/__tests__/gemini-core.test.js +53 -0
- package/dist/mcp/__tests__/gemini-core.test.js.map +1 -0
- package/dist/mcp/__tests__/job-state-db-deprecation.test.js +48 -1
- package/dist/mcp/__tests__/job-state-db-deprecation.test.js.map +1 -1
- package/dist/mcp/__tests__/omc-tools-server.test.d.ts +2 -0
- package/dist/mcp/__tests__/omc-tools-server.test.d.ts.map +1 -0
- package/dist/mcp/__tests__/omc-tools-server.test.js +108 -0
- package/dist/mcp/__tests__/omc-tools-server.test.js.map +1 -0
- package/dist/mcp/job-state-db.d.ts +1 -1
- package/dist/mcp/job-state-db.d.ts.map +1 -1
- package/dist/mcp/prompt-persistence.d.ts +2 -17
- package/dist/mcp/prompt-persistence.d.ts.map +1 -1
- package/dist/mcp/prompt-persistence.js.map +1 -1
- package/dist/team/__tests__/deadlock-detector.test.d.ts +2 -0
- package/dist/team/__tests__/deadlock-detector.test.d.ts.map +1 -0
- package/dist/team/__tests__/deadlock-detector.test.js +50 -0
- package/dist/team/__tests__/deadlock-detector.test.js.map +1 -0
- package/dist/team/__tests__/dependency-graph.test.d.ts +2 -0
- package/dist/team/__tests__/dependency-graph.test.d.ts.map +1 -0
- package/dist/team/__tests__/dependency-graph.test.js +29 -0
- package/dist/team/__tests__/dependency-graph.test.js.map +1 -0
- package/dist/team/capabilities.d.ts +1 -2
- package/dist/team/capabilities.d.ts.map +1 -1
- package/dist/team/capabilities.js.map +1 -1
- package/dist/team/deadlock-detector.d.ts +16 -0
- package/dist/team/deadlock-detector.d.ts.map +1 -0
- package/dist/team/deadlock-detector.js +52 -0
- package/dist/team/deadlock-detector.js.map +1 -0
- package/dist/team/dependency-graph.d.ts +23 -0
- package/dist/team/dependency-graph.d.ts.map +1 -0
- package/dist/team/dependency-graph.js +35 -0
- package/dist/team/dependency-graph.js.map +1 -0
- package/dist/team/index.d.ts +3 -0
- package/dist/team/index.d.ts.map +1 -1
- package/dist/team/index.js +2 -0
- package/dist/team/index.js.map +1 -1
- package/dist/team/types.d.ts +15 -4
- package/dist/team/types.d.ts.map +1 -1
- package/dist/team/types.js +0 -1
- package/dist/team/types.js.map +1 -1
- package/dist/team/unified-team.d.ts +2 -11
- package/dist/team/unified-team.d.ts.map +1 -1
- package/dist/team/unified-team.js.map +1 -1
- package/dist/tools/__tests__/ast-tools.test.d.ts +2 -0
- package/dist/tools/__tests__/ast-tools.test.d.ts.map +1 -0
- package/dist/tools/__tests__/ast-tools.test.js +178 -0
- package/dist/tools/__tests__/ast-tools.test.js.map +1 -0
- package/dist/tools/__tests__/lsp-tools.test.d.ts +2 -0
- package/dist/tools/__tests__/lsp-tools.test.d.ts.map +1 -0
- package/dist/tools/__tests__/lsp-tools.test.js +252 -0
- package/dist/tools/__tests__/lsp-tools.test.js.map +1 -0
- package/dist/tools/diagnostics/__tests__/index.test.d.ts +2 -0
- package/dist/tools/diagnostics/__tests__/index.test.d.ts.map +1 -0
- package/dist/tools/diagnostics/__tests__/index.test.js +111 -0
- package/dist/tools/diagnostics/__tests__/index.test.js.map +1 -0
- package/dist/tools/diagnostics/__tests__/lsp-aggregator.test.d.ts +2 -0
- package/dist/tools/diagnostics/__tests__/lsp-aggregator.test.d.ts.map +1 -0
- package/dist/tools/diagnostics/__tests__/lsp-aggregator.test.js +120 -0
- package/dist/tools/diagnostics/__tests__/lsp-aggregator.test.js.map +1 -0
- package/dist/tools/diagnostics/__tests__/tsc-runner.test.d.ts +2 -0
- package/dist/tools/diagnostics/__tests__/tsc-runner.test.d.ts.map +1 -0
- package/dist/tools/diagnostics/__tests__/tsc-runner.test.js +86 -0
- package/dist/tools/diagnostics/__tests__/tsc-runner.test.js.map +1 -0
- package/dist/tools/diagnostics/constants.d.ts +5 -0
- package/dist/tools/diagnostics/constants.d.ts.map +1 -0
- package/dist/tools/diagnostics/constants.js +5 -0
- package/dist/tools/diagnostics/constants.js.map +1 -0
- package/dist/tools/diagnostics/index.d.ts +2 -1
- package/dist/tools/diagnostics/index.d.ts.map +1 -1
- package/dist/tools/diagnostics/index.js +2 -1
- package/dist/tools/diagnostics/index.js.map +1 -1
- package/dist/tools/diagnostics/lsp-aggregator.js +1 -1
- package/dist/tools/diagnostics/lsp-aggregator.js.map +1 -1
- package/dist/tools/lsp/__tests__/utils.test.d.ts +2 -0
- package/dist/tools/lsp/__tests__/utils.test.d.ts.map +1 -0
- package/dist/tools/lsp/__tests__/utils.test.js +338 -0
- package/dist/tools/lsp/__tests__/utils.test.js.map +1 -0
- package/dist/tools/lsp/utils.d.ts.map +1 -1
- package/dist/tools/lsp/utils.js +2 -2
- package/dist/tools/lsp/utils.js.map +1 -1
- package/dist/tools/python-repl/__tests__/bridge-manager.test.d.ts +2 -0
- package/dist/tools/python-repl/__tests__/bridge-manager.test.d.ts.map +1 -0
- package/dist/tools/python-repl/__tests__/bridge-manager.test.js +338 -0
- package/dist/tools/python-repl/__tests__/bridge-manager.test.js.map +1 -0
- package/dist/tools/python-repl/__tests__/socket-client.test.d.ts +2 -0
- package/dist/tools/python-repl/__tests__/socket-client.test.d.ts.map +1 -0
- package/dist/tools/python-repl/__tests__/socket-client.test.js +155 -0
- package/dist/tools/python-repl/__tests__/socket-client.test.js.map +1 -0
- package/dist/tools/python-repl/bridge-manager.d.ts +4 -0
- package/dist/tools/python-repl/bridge-manager.d.ts.map +1 -1
- package/dist/tools/python-repl/bridge-manager.js +4 -1
- package/dist/tools/python-repl/bridge-manager.js.map +1 -1
- package/docs/guides/task-templates-guide.md +153 -0
- package/docs/guides/troubleshooting-guide.md +110 -0
- package/docs/guides/wizard-user-guide.md +85 -0
- package/docs/guides/workflow-recommendation-guide.md +97 -0
- package/docs/reviews/ultrapower-security/review_critic.md +450 -0
- package/docs/reviews/ultrapower-tech-review/review_tech.md +180 -0
- package/docs/troubleshooting/agent-timeouts.md +37 -0
- package/docs/troubleshooting/common-errors.md +37 -0
- package/docs/troubleshooting/hook-failures.md +29 -0
- package/docs/troubleshooting/performance-issues.md +41 -0
- package/docs/troubleshooting/state-corruption.md +36 -0
- package/hooks/run-hook.cmd +0 -0
- package/hooks/session-start +0 -0
- package/package.json +1 -1
- package/scripts/analyze-dependencies.ts +47 -0
- package/scripts/analyze-hook-coverage.ts +55 -0
- package/scripts/performance-regression.ts +28 -0
- package/scripts/persistent-mode.cjs +605 -605
- package/scripts/profiling.ts +95 -0
- package/scripts/run-profiling.ts +64 -0
- package/scripts/test-parallel-execution.ts +72 -0
- package/scripts/test-race-detection.ts +57 -0
- package/scripts/test-tiered-writer.ts +60 -0
- package/scripts/test-wal-integration.ts +29 -0
- package/scripts/test-wal.ts +48 -0
- package/skills/next-step-router/SKILL.md +17 -0
- package/skills/systematic-debugging/find-polluter.sh +0 -0
- package/skills/wizard/SKILL.md +103 -72
- package/skills/writing-skills/graphviz-conventions.dot +171 -171
- package/skills/writing-skills/render-graphs.js +0 -0
- package/templates/axiom/scripts/Check-Memory.ps1 +68 -68
- package/templates/axiom/scripts/Poll-Memory.ps1 +36 -36
- package/templates/axiom/scripts/Watch-Memory.ps1 +149 -149
- package/templates/axiom/scripts/agent-runner.ps1 +101 -101
- package/templates/axiom/scripts/start-reviews.ps1 +19 -19
- package/templates/tasks/README.md +45 -0
- package/templates/tasks/bug-fix.md +37 -0
- package/templates/tasks/code-review.md +36 -0
- package/templates/tasks/feature-development.md +43 -0
- package/templates/tasks/refactoring.md +37 -0
- package/templates/tasks/security-audit.md +37 -0
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
param (
|
|
3
|
-
[Parameter(Mandatory=$true)]
|
|
4
|
-
[string]$SessionId,
|
|
5
|
-
|
|
6
|
-
[int]$Threshold = 2
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
$ErrorActionPreference = "SilentlyContinue"
|
|
10
|
-
|
|
11
|
-
# 1. Define Paths
|
|
12
|
-
$AgentRoot = Resolve-Path "$PSScriptRoot\..\.."
|
|
13
|
-
$MemoryDir = Join-Path $AgentRoot ".agent\memory"
|
|
14
|
-
$TargetFile = Join-Path $MemoryDir "active_context.md"
|
|
15
|
-
$StatusFile = Join-Path $MemoryDir "watchdog_status.lock"
|
|
16
|
-
$TempFile = Join-Path $MemoryDir "watchdog_status.tmp"
|
|
17
|
-
|
|
18
|
-
# 2. Check Context Load (Latest PB File Size)
|
|
19
|
-
$Status = "NORMAL"
|
|
20
|
-
$SizeMB = 0
|
|
21
|
-
|
|
22
|
-
# Path to Axiom Conversations Directory
|
|
23
|
-
# Dynamic detection for Windows ($env:USERPROFILE) and macOS/Linux ($env:HOME)
|
|
24
|
-
$HomeDir = if ($env:USERPROFILE) { $env:USERPROFILE } else { $env:HOME }
|
|
25
|
-
$ConversationsDir = Join-Path $HomeDir ".gemini\axiom\conversations"
|
|
26
|
-
|
|
27
|
-
if (Test-Path $ConversationsDir) {
|
|
28
|
-
# Get the most recently modified .pb file
|
|
29
|
-
$LatestPb = Get-ChildItem -Path $ConversationsDir -Filter "*.pb" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
|
|
30
|
-
|
|
31
|
-
if ($LatestPb) {
|
|
32
|
-
$SizeBytes = $LatestPb.Length
|
|
33
|
-
$SizeMB = [math]::Round($SizeBytes / 1MB, 4)
|
|
34
|
-
|
|
35
|
-
Write-Host " [Watchdog] Monitoring: $($LatestPb.Name) ($SizeMB MB)" -ForegroundColor DarkGray
|
|
36
|
-
|
|
37
|
-
# Threshold handling
|
|
38
|
-
if ($SizeMB -ge $Threshold) {
|
|
39
|
-
$Status = "CRITICAL"
|
|
40
|
-
} elseif ($SizeMB -ge ($Threshold * 0.8)) {
|
|
41
|
-
$Status = "WARNING"
|
|
42
|
-
}
|
|
43
|
-
} else {
|
|
44
|
-
Write-Host " [Watchdog] No .pb files found to monitor." -ForegroundColor Yellow
|
|
45
|
-
}
|
|
46
|
-
} else {
|
|
47
|
-
Write-Host " [Watchdog] Conversations directory not found: $ConversationsDir" -ForegroundColor Red
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
# 3. Create JSON Payload
|
|
51
|
-
$Payload = @{
|
|
52
|
-
status = $Status
|
|
53
|
-
size_mb = $SizeMB
|
|
54
|
-
limit_mb = $Threshold
|
|
55
|
-
timestamp = [int64]((Get-Date).ToUniversalTime() - (Get-Date "1970-01-01")).TotalSeconds
|
|
56
|
-
session_id = $SessionId
|
|
57
|
-
} | ConvertTo-Json -Compress
|
|
58
|
-
|
|
59
|
-
# 4. Atomic Write
|
|
60
|
-
try {
|
|
61
|
-
$Payload | Set-Content -Path $TempFile -Encoding UTF8 -Force
|
|
62
|
-
Move-Item -Path $TempFile -Destination $StatusFile -Force
|
|
63
|
-
} catch {
|
|
64
|
-
# Silent fail, maybe log if verbose
|
|
65
|
-
if ($PSBoundParameters['Verbose']) {
|
|
66
|
-
Write-Error $_
|
|
67
|
-
}
|
|
68
|
-
}
|
|
1
|
+
|
|
2
|
+
param (
|
|
3
|
+
[Parameter(Mandatory=$true)]
|
|
4
|
+
[string]$SessionId,
|
|
5
|
+
|
|
6
|
+
[int]$Threshold = 2
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
$ErrorActionPreference = "SilentlyContinue"
|
|
10
|
+
|
|
11
|
+
# 1. Define Paths
|
|
12
|
+
$AgentRoot = Resolve-Path "$PSScriptRoot\..\.."
|
|
13
|
+
$MemoryDir = Join-Path $AgentRoot ".agent\memory"
|
|
14
|
+
$TargetFile = Join-Path $MemoryDir "active_context.md"
|
|
15
|
+
$StatusFile = Join-Path $MemoryDir "watchdog_status.lock"
|
|
16
|
+
$TempFile = Join-Path $MemoryDir "watchdog_status.tmp"
|
|
17
|
+
|
|
18
|
+
# 2. Check Context Load (Latest PB File Size)
|
|
19
|
+
$Status = "NORMAL"
|
|
20
|
+
$SizeMB = 0
|
|
21
|
+
|
|
22
|
+
# Path to Axiom Conversations Directory
|
|
23
|
+
# Dynamic detection for Windows ($env:USERPROFILE) and macOS/Linux ($env:HOME)
|
|
24
|
+
$HomeDir = if ($env:USERPROFILE) { $env:USERPROFILE } else { $env:HOME }
|
|
25
|
+
$ConversationsDir = Join-Path $HomeDir ".gemini\axiom\conversations"
|
|
26
|
+
|
|
27
|
+
if (Test-Path $ConversationsDir) {
|
|
28
|
+
# Get the most recently modified .pb file
|
|
29
|
+
$LatestPb = Get-ChildItem -Path $ConversationsDir -Filter "*.pb" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
|
|
30
|
+
|
|
31
|
+
if ($LatestPb) {
|
|
32
|
+
$SizeBytes = $LatestPb.Length
|
|
33
|
+
$SizeMB = [math]::Round($SizeBytes / 1MB, 4)
|
|
34
|
+
|
|
35
|
+
Write-Host " [Watchdog] Monitoring: $($LatestPb.Name) ($SizeMB MB)" -ForegroundColor DarkGray
|
|
36
|
+
|
|
37
|
+
# Threshold handling
|
|
38
|
+
if ($SizeMB -ge $Threshold) {
|
|
39
|
+
$Status = "CRITICAL"
|
|
40
|
+
} elseif ($SizeMB -ge ($Threshold * 0.8)) {
|
|
41
|
+
$Status = "WARNING"
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
Write-Host " [Watchdog] No .pb files found to monitor." -ForegroundColor Yellow
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
Write-Host " [Watchdog] Conversations directory not found: $ConversationsDir" -ForegroundColor Red
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
# 3. Create JSON Payload
|
|
51
|
+
$Payload = @{
|
|
52
|
+
status = $Status
|
|
53
|
+
size_mb = $SizeMB
|
|
54
|
+
limit_mb = $Threshold
|
|
55
|
+
timestamp = [int64]((Get-Date).ToUniversalTime() - (Get-Date "1970-01-01")).TotalSeconds
|
|
56
|
+
session_id = $SessionId
|
|
57
|
+
} | ConvertTo-Json -Compress
|
|
58
|
+
|
|
59
|
+
# 4. Atomic Write
|
|
60
|
+
try {
|
|
61
|
+
$Payload | Set-Content -Path $TempFile -Encoding UTF8 -Force
|
|
62
|
+
Move-Item -Path $TempFile -Destination $StatusFile -Force
|
|
63
|
+
} catch {
|
|
64
|
+
# Silent fail, maybe log if verbose
|
|
65
|
+
if ($PSBoundParameters['Verbose']) {
|
|
66
|
+
Write-Error $_
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
param([int]$Interval = 2)
|
|
2
|
-
|
|
3
|
-
$HomeDir = if ($env:USERPROFILE) { $env:USERPROFILE } else { $env:HOME }
|
|
4
|
-
if (-not $HomeDir) {
|
|
5
|
-
Write-Host "Error: Could not determine HOME directory." -ForegroundColor Red
|
|
6
|
-
exit 1
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
$TargetDir = Join-Path $HomeDir ".gemini\axiom\conversations"
|
|
10
|
-
Write-Host "Polling $TargetDir every $Interval seconds..." -ForegroundColor Cyan
|
|
11
|
-
|
|
12
|
-
$LastTime = $null
|
|
13
|
-
$LastSize = 0
|
|
14
|
-
|
|
15
|
-
while ($true) {
|
|
16
|
-
if (Test-Path $TargetDir) {
|
|
17
|
-
$Latest = Get-ChildItem -Path $TargetDir -Filter "*.pb" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
|
|
18
|
-
|
|
19
|
-
if ($Latest) {
|
|
20
|
-
$CurrentTime = $Latest.LastWriteTime
|
|
21
|
-
$CurrentSize = $Latest.Length
|
|
22
|
-
|
|
23
|
-
# If time changed or size changed
|
|
24
|
-
if ($LastTime -ne $CurrentTime -or $LastSize -ne $CurrentSize) {
|
|
25
|
-
$SizeMB = [math]::Round($CurrentSize / 1MB, 4)
|
|
26
|
-
Write-Host " [POLL] Change Detected: $($Latest.Name)" -ForegroundColor Yellow
|
|
27
|
-
Write-Host " Time: $CurrentTime"
|
|
28
|
-
Write-Host " Size: $SizeMB MB"
|
|
29
|
-
|
|
30
|
-
$LastTime = $CurrentTime
|
|
31
|
-
$LastSize = $CurrentSize
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
Start-Sleep -Seconds $Interval
|
|
36
|
-
}
|
|
1
|
+
param([int]$Interval = 2)
|
|
2
|
+
|
|
3
|
+
$HomeDir = if ($env:USERPROFILE) { $env:USERPROFILE } else { $env:HOME }
|
|
4
|
+
if (-not $HomeDir) {
|
|
5
|
+
Write-Host "Error: Could not determine HOME directory." -ForegroundColor Red
|
|
6
|
+
exit 1
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
$TargetDir = Join-Path $HomeDir ".gemini\axiom\conversations"
|
|
10
|
+
Write-Host "Polling $TargetDir every $Interval seconds..." -ForegroundColor Cyan
|
|
11
|
+
|
|
12
|
+
$LastTime = $null
|
|
13
|
+
$LastSize = 0
|
|
14
|
+
|
|
15
|
+
while ($true) {
|
|
16
|
+
if (Test-Path $TargetDir) {
|
|
17
|
+
$Latest = Get-ChildItem -Path $TargetDir -Filter "*.pb" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
|
|
18
|
+
|
|
19
|
+
if ($Latest) {
|
|
20
|
+
$CurrentTime = $Latest.LastWriteTime
|
|
21
|
+
$CurrentSize = $Latest.Length
|
|
22
|
+
|
|
23
|
+
# If time changed or size changed
|
|
24
|
+
if ($LastTime -ne $CurrentTime -or $LastSize -ne $CurrentSize) {
|
|
25
|
+
$SizeMB = [math]::Round($CurrentSize / 1MB, 4)
|
|
26
|
+
Write-Host " [POLL] Change Detected: $($Latest.Name)" -ForegroundColor Yellow
|
|
27
|
+
Write-Host " Time: $CurrentTime"
|
|
28
|
+
Write-Host " Size: $SizeMB MB"
|
|
29
|
+
|
|
30
|
+
$LastTime = $CurrentTime
|
|
31
|
+
$LastSize = $CurrentSize
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
Start-Sleep -Seconds $Interval
|
|
36
|
+
}
|
|
@@ -1,149 +1,149 @@
|
|
|
1
|
-
#!/usr/bin/env pwsh
|
|
2
|
-
# .agent/scripts/Watch-Memory.ps1
|
|
3
|
-
# Real-time Memory Watchdog: Monitors .pb file changes and updates status lock.
|
|
4
|
-
|
|
5
|
-
param(
|
|
6
|
-
[int]$ThresholdMB = 2,
|
|
7
|
-
[bool]$ShowToasts = $true
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
# 1. Setup Paths
|
|
11
|
-
$ScriptDir = $PSScriptRoot
|
|
12
|
-
$AgentRoot = Resolve-Path "$ScriptDir\..\.."
|
|
13
|
-
$MemoryDir = Join-Path $AgentRoot ".agent\memory"
|
|
14
|
-
$StatusFile = Join-Path $MemoryDir "watchdog_status.lock"
|
|
15
|
-
$TempFile = Join-Path $MemoryDir "watchdog_status.tmp"
|
|
16
|
-
|
|
17
|
-
# Dynamic detection for Axiom Paths
|
|
18
|
-
$HomeDir = [Environment]::GetFolderPath("UserProfile")
|
|
19
|
-
if ([string]::IsNullOrEmpty($HomeDir)) {
|
|
20
|
-
$HomeDir = $HOME
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if ([string]::IsNullOrEmpty($HomeDir)) {
|
|
24
|
-
Write-Host "Error: Could not determine HOME directory." -ForegroundColor Red
|
|
25
|
-
exit 1
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
$ConversationsDir = Join-Path $HomeDir ".gemini\axiom\conversations"
|
|
29
|
-
|
|
30
|
-
if (-not (Test-Path $ConversationsDir)) {
|
|
31
|
-
Write-Host "Error: Conversations directory not found: $ConversationsDir" -ForegroundColor Red
|
|
32
|
-
exit 1
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
Write-Host " [Watchdog] Starting Real-time Monitor..." -ForegroundColor Cyan
|
|
36
|
-
Write-Host " Target: $ConversationsDir" -ForegroundColor DarkGray
|
|
37
|
-
Write-Host " Threshold: $ThresholdMB MB" -ForegroundColor DarkGray
|
|
38
|
-
Write-Host " Status File: $StatusFile" -ForegroundColor DarkGray
|
|
39
|
-
|
|
40
|
-
# Global Cached State
|
|
41
|
-
$Global:LastCheck = @{
|
|
42
|
-
FileName = ""
|
|
43
|
-
SizeMB = 0.0
|
|
44
|
-
Status = "NORMAL"
|
|
45
|
-
Time = 0 # timestamp
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
# 2. Define Action Block
|
|
49
|
-
$Action = {
|
|
50
|
-
$FilePath = $Event.SourceEventArgs.FullPath
|
|
51
|
-
$ChangeType = $Event.SourceEventArgs.ChangeType
|
|
52
|
-
$FileName = $Event.SourceEventArgs.Name
|
|
53
|
-
|
|
54
|
-
# We only care about .pb files
|
|
55
|
-
if ($FileName -like "*.pb") {
|
|
56
|
-
try {
|
|
57
|
-
# Debounce: Wait a tiny bit for write to complete
|
|
58
|
-
Start-Sleep -Milliseconds 200
|
|
59
|
-
|
|
60
|
-
$Item = Get-Item $FilePath -ErrorAction SilentlyContinue
|
|
61
|
-
if ($null -eq $Item) { return }
|
|
62
|
-
|
|
63
|
-
$SizeMB = [math]::Round($Item.Length / 1MB, 4)
|
|
64
|
-
$Status = "NORMAL"
|
|
65
|
-
|
|
66
|
-
if ($SizeMB -ge $ThresholdMB) {
|
|
67
|
-
$Status = "CRITICAL"
|
|
68
|
-
$Color = "Red"
|
|
69
|
-
}
|
|
70
|
-
elseif ($SizeMB -ge ($ThresholdMB * 0.8)) {
|
|
71
|
-
$Status = "WARNING"
|
|
72
|
-
$Color = "Yellow"
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
$Color = "Green"
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
# --- OPTIMIZATION START ---
|
|
79
|
-
$CurrentTime = [int64]((Get-Date).ToUniversalTime() - (Get-Date "1970-01-01")).TotalSeconds
|
|
80
|
-
|
|
81
|
-
# Check if redundant update
|
|
82
|
-
$IsSameFile = ($FileName -eq $Global:LastCheck.FileName)
|
|
83
|
-
$IsSameStatus = ($Status -eq $Global:LastCheck.Status)
|
|
84
|
-
$SizeDiff = [math]::Abs($SizeMB - $Global:LastCheck.SizeMB)
|
|
85
|
-
$TimeSinceLast = $CurrentTime - $Global:LastCheck.Time
|
|
86
|
-
|
|
87
|
-
# Rule 1: If exactly same status and size negligible change (< 0.01 MB), skip
|
|
88
|
-
if ($IsSameFile -and $IsSameStatus -and ($SizeDiff -lt 0.01)) {
|
|
89
|
-
return
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
# Update Cache
|
|
93
|
-
$Global:LastCheck.FileName = $FileName
|
|
94
|
-
$Global:LastCheck.SizeMB = $SizeMB
|
|
95
|
-
$Global:LastCheck.Status = $Status
|
|
96
|
-
$Global:LastCheck.Time = $CurrentTime
|
|
97
|
-
# --- OPTIMIZATION END ---
|
|
98
|
-
|
|
99
|
-
# Print Log
|
|
100
|
-
$TimeStr = Get-Date -Format "HH:mm:ss"
|
|
101
|
-
Write-Host (" [{0}] {1}: {2} -> {3} MB ({4})" -f $TimeStr, $ChangeType, $FileName, $SizeMB, $Status) -ForegroundColor $Color
|
|
102
|
-
|
|
103
|
-
# Update Lock File Logic
|
|
104
|
-
if ($Status -ne "NORMAL") {
|
|
105
|
-
$Payload = @{
|
|
106
|
-
status = $Status
|
|
107
|
-
size_mb = $SizeMB
|
|
108
|
-
limit_mb = $ThresholdMB
|
|
109
|
-
timestamp = $CurrentTime
|
|
110
|
-
session_id = $FileName
|
|
111
|
-
} | ConvertTo-Json -Compress
|
|
112
|
-
|
|
113
|
-
$Payload | Set-Content -Path $TempFile -Encoding UTF8 -Force
|
|
114
|
-
Move-Item -Path $TempFile -Destination $StatusFile -Force
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
# Clear lock file if back to normal (But only do it ONCE when status CHANGES to normal)
|
|
118
|
-
if ($IsSameStatus -eq $false -and (Test-Path $StatusFile)) {
|
|
119
|
-
$Payload = @{ status = "NORMAL"; timestamp = $CurrentTime; session_id = $FileName } | ConvertTo-Json -Compress
|
|
120
|
-
$Payload | Set-Content -Path $TempFile -Encoding UTF8 -Force
|
|
121
|
-
Move-Item -Path $TempFile -Destination $StatusFile -Force
|
|
122
|
-
Write-Host " [Watchdog] cleared status lock." -ForegroundColor Gray
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
catch {
|
|
127
|
-
Write-Host "Error processing event: $_" -ForegroundColor Red
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
# 3. Setup FileSystemWatcher
|
|
133
|
-
$Watcher = New-Object System.IO.FileSystemWatcher
|
|
134
|
-
$Watcher.Path = $ConversationsDir
|
|
135
|
-
$Watcher.Filter = "*.pb"
|
|
136
|
-
$Watcher.IncludeSubdirectories = $false
|
|
137
|
-
$Watcher.EnableRaisingEvents = $true
|
|
138
|
-
|
|
139
|
-
# Register Events
|
|
140
|
-
Register-ObjectEvent $Watcher "Changed" -Action $Action | Out-Null
|
|
141
|
-
Register-ObjectEvent $Watcher "Created" -Action $Action | Out-Null
|
|
142
|
-
Register-ObjectEvent $Watcher "Renamed" -Action $Action | Out-Null
|
|
143
|
-
|
|
144
|
-
Write-Host " [Watchdog] Monitoring active. Press Ctrl+C to stop." -ForegroundColor Green
|
|
145
|
-
|
|
146
|
-
# Keep script running
|
|
147
|
-
while ($true) {
|
|
148
|
-
Start-Sleep -Seconds 1
|
|
149
|
-
}
|
|
1
|
+
#!/usr/bin/env pwsh
|
|
2
|
+
# .agent/scripts/Watch-Memory.ps1
|
|
3
|
+
# Real-time Memory Watchdog: Monitors .pb file changes and updates status lock.
|
|
4
|
+
|
|
5
|
+
param(
|
|
6
|
+
[int]$ThresholdMB = 2,
|
|
7
|
+
[bool]$ShowToasts = $true
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
# 1. Setup Paths
|
|
11
|
+
$ScriptDir = $PSScriptRoot
|
|
12
|
+
$AgentRoot = Resolve-Path "$ScriptDir\..\.."
|
|
13
|
+
$MemoryDir = Join-Path $AgentRoot ".agent\memory"
|
|
14
|
+
$StatusFile = Join-Path $MemoryDir "watchdog_status.lock"
|
|
15
|
+
$TempFile = Join-Path $MemoryDir "watchdog_status.tmp"
|
|
16
|
+
|
|
17
|
+
# Dynamic detection for Axiom Paths
|
|
18
|
+
$HomeDir = [Environment]::GetFolderPath("UserProfile")
|
|
19
|
+
if ([string]::IsNullOrEmpty($HomeDir)) {
|
|
20
|
+
$HomeDir = $HOME
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if ([string]::IsNullOrEmpty($HomeDir)) {
|
|
24
|
+
Write-Host "Error: Could not determine HOME directory." -ForegroundColor Red
|
|
25
|
+
exit 1
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
$ConversationsDir = Join-Path $HomeDir ".gemini\axiom\conversations"
|
|
29
|
+
|
|
30
|
+
if (-not (Test-Path $ConversationsDir)) {
|
|
31
|
+
Write-Host "Error: Conversations directory not found: $ConversationsDir" -ForegroundColor Red
|
|
32
|
+
exit 1
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
Write-Host " [Watchdog] Starting Real-time Monitor..." -ForegroundColor Cyan
|
|
36
|
+
Write-Host " Target: $ConversationsDir" -ForegroundColor DarkGray
|
|
37
|
+
Write-Host " Threshold: $ThresholdMB MB" -ForegroundColor DarkGray
|
|
38
|
+
Write-Host " Status File: $StatusFile" -ForegroundColor DarkGray
|
|
39
|
+
|
|
40
|
+
# Global Cached State
|
|
41
|
+
$Global:LastCheck = @{
|
|
42
|
+
FileName = ""
|
|
43
|
+
SizeMB = 0.0
|
|
44
|
+
Status = "NORMAL"
|
|
45
|
+
Time = 0 # timestamp
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
# 2. Define Action Block
|
|
49
|
+
$Action = {
|
|
50
|
+
$FilePath = $Event.SourceEventArgs.FullPath
|
|
51
|
+
$ChangeType = $Event.SourceEventArgs.ChangeType
|
|
52
|
+
$FileName = $Event.SourceEventArgs.Name
|
|
53
|
+
|
|
54
|
+
# We only care about .pb files
|
|
55
|
+
if ($FileName -like "*.pb") {
|
|
56
|
+
try {
|
|
57
|
+
# Debounce: Wait a tiny bit for write to complete
|
|
58
|
+
Start-Sleep -Milliseconds 200
|
|
59
|
+
|
|
60
|
+
$Item = Get-Item $FilePath -ErrorAction SilentlyContinue
|
|
61
|
+
if ($null -eq $Item) { return }
|
|
62
|
+
|
|
63
|
+
$SizeMB = [math]::Round($Item.Length / 1MB, 4)
|
|
64
|
+
$Status = "NORMAL"
|
|
65
|
+
|
|
66
|
+
if ($SizeMB -ge $ThresholdMB) {
|
|
67
|
+
$Status = "CRITICAL"
|
|
68
|
+
$Color = "Red"
|
|
69
|
+
}
|
|
70
|
+
elseif ($SizeMB -ge ($ThresholdMB * 0.8)) {
|
|
71
|
+
$Status = "WARNING"
|
|
72
|
+
$Color = "Yellow"
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
$Color = "Green"
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
# --- OPTIMIZATION START ---
|
|
79
|
+
$CurrentTime = [int64]((Get-Date).ToUniversalTime() - (Get-Date "1970-01-01")).TotalSeconds
|
|
80
|
+
|
|
81
|
+
# Check if redundant update
|
|
82
|
+
$IsSameFile = ($FileName -eq $Global:LastCheck.FileName)
|
|
83
|
+
$IsSameStatus = ($Status -eq $Global:LastCheck.Status)
|
|
84
|
+
$SizeDiff = [math]::Abs($SizeMB - $Global:LastCheck.SizeMB)
|
|
85
|
+
$TimeSinceLast = $CurrentTime - $Global:LastCheck.Time
|
|
86
|
+
|
|
87
|
+
# Rule 1: If exactly same status and size negligible change (< 0.01 MB), skip
|
|
88
|
+
if ($IsSameFile -and $IsSameStatus -and ($SizeDiff -lt 0.01)) {
|
|
89
|
+
return
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
# Update Cache
|
|
93
|
+
$Global:LastCheck.FileName = $FileName
|
|
94
|
+
$Global:LastCheck.SizeMB = $SizeMB
|
|
95
|
+
$Global:LastCheck.Status = $Status
|
|
96
|
+
$Global:LastCheck.Time = $CurrentTime
|
|
97
|
+
# --- OPTIMIZATION END ---
|
|
98
|
+
|
|
99
|
+
# Print Log
|
|
100
|
+
$TimeStr = Get-Date -Format "HH:mm:ss"
|
|
101
|
+
Write-Host (" [{0}] {1}: {2} -> {3} MB ({4})" -f $TimeStr, $ChangeType, $FileName, $SizeMB, $Status) -ForegroundColor $Color
|
|
102
|
+
|
|
103
|
+
# Update Lock File Logic
|
|
104
|
+
if ($Status -ne "NORMAL") {
|
|
105
|
+
$Payload = @{
|
|
106
|
+
status = $Status
|
|
107
|
+
size_mb = $SizeMB
|
|
108
|
+
limit_mb = $ThresholdMB
|
|
109
|
+
timestamp = $CurrentTime
|
|
110
|
+
session_id = $FileName
|
|
111
|
+
} | ConvertTo-Json -Compress
|
|
112
|
+
|
|
113
|
+
$Payload | Set-Content -Path $TempFile -Encoding UTF8 -Force
|
|
114
|
+
Move-Item -Path $TempFile -Destination $StatusFile -Force
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
# Clear lock file if back to normal (But only do it ONCE when status CHANGES to normal)
|
|
118
|
+
if ($IsSameStatus -eq $false -and (Test-Path $StatusFile)) {
|
|
119
|
+
$Payload = @{ status = "NORMAL"; timestamp = $CurrentTime; session_id = $FileName } | ConvertTo-Json -Compress
|
|
120
|
+
$Payload | Set-Content -Path $TempFile -Encoding UTF8 -Force
|
|
121
|
+
Move-Item -Path $TempFile -Destination $StatusFile -Force
|
|
122
|
+
Write-Host " [Watchdog] cleared status lock." -ForegroundColor Gray
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
Write-Host "Error processing event: $_" -ForegroundColor Red
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
# 3. Setup FileSystemWatcher
|
|
133
|
+
$Watcher = New-Object System.IO.FileSystemWatcher
|
|
134
|
+
$Watcher.Path = $ConversationsDir
|
|
135
|
+
$Watcher.Filter = "*.pb"
|
|
136
|
+
$Watcher.IncludeSubdirectories = $false
|
|
137
|
+
$Watcher.EnableRaisingEvents = $true
|
|
138
|
+
|
|
139
|
+
# Register Events
|
|
140
|
+
Register-ObjectEvent $Watcher "Changed" -Action $Action | Out-Null
|
|
141
|
+
Register-ObjectEvent $Watcher "Created" -Action $Action | Out-Null
|
|
142
|
+
Register-ObjectEvent $Watcher "Renamed" -Action $Action | Out-Null
|
|
143
|
+
|
|
144
|
+
Write-Host " [Watchdog] Monitoring active. Press Ctrl+C to stop." -ForegroundColor Green
|
|
145
|
+
|
|
146
|
+
# Keep script running
|
|
147
|
+
while ($true) {
|
|
148
|
+
Start-Sleep -Seconds 1
|
|
149
|
+
}
|