qlogicagent 2.10.22 → 2.10.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -4
- package/dist/agent.js +11 -11
- package/dist/cli.js +701 -604
- package/dist/index.js +700 -603
- package/dist/permissions.js +1 -0
- package/dist/protocol.js +1 -1
- package/dist/types/agent/tool-access.d.ts +1 -30
- package/dist/types/agent/tunable-defaults.d.ts +1 -249
- package/dist/types/agent/types.d.ts +7 -0
- package/dist/types/cli/acp-extended-handlers.d.ts +41 -0
- package/dist/types/cli/acp-extended-host-adapter.d.ts +28 -0
- package/dist/types/cli/acp-extended-host-adapter.test.d.ts +1 -0
- package/dist/types/cli/acp-session-handlers.d.ts +39 -0
- package/dist/types/cli/acp-session-handlers.test.d.ts +1 -0
- package/dist/types/cli/agent-config-coordinator.d.ts +13 -0
- package/dist/types/cli/agent-config-runtime.d.ts +11 -0
- package/dist/types/cli/agent-runner-factory.d.ts +2 -0
- package/dist/types/cli/agent-runtime-bootstrap.d.ts +64 -0
- package/dist/types/cli/agent-status-notifier.d.ts +11 -0
- package/dist/types/cli/agent-status-notifier.test.d.ts +1 -0
- package/dist/types/cli/base-tool-bootstrap.d.ts +7 -0
- package/dist/types/cli/cli-acp-request-handler.d.ts +9 -0
- package/dist/types/cli/cli-acp-request-handler.test.d.ts +1 -0
- package/dist/types/cli/cli-agent-builder.d.ts +35 -0
- package/dist/types/cli/community-skill-installer.d.ts +12 -0
- package/dist/types/cli/community-skill-installer.test.d.ts +1 -0
- package/dist/types/cli/core-tool-coordinator.d.ts +30 -0
- package/dist/types/cli/core-tools/agent-tool-bootstrap.d.ts +10 -0
- package/dist/types/cli/core-tools/agent-tool-service.d.ts +18 -0
- package/dist/types/cli/core-tools/checkpoint-tool-bootstrap.d.ts +7 -0
- package/dist/types/cli/core-tools/checkpoint-tool-service.d.ts +7 -0
- package/dist/types/cli/core-tools/config-tool-bootstrap.d.ts +7 -0
- package/dist/types/cli/core-tools/config-tool-service.d.ts +7 -0
- package/dist/types/cli/core-tools/cron-tool-bootstrap.d.ts +7 -0
- package/dist/types/cli/core-tools/cron-tool-service.d.ts +22 -0
- package/dist/types/cli/core-tools/cron-tool-service.test.d.ts +1 -0
- package/dist/types/cli/core-tools/monitor-tool-bootstrap.d.ts +5 -0
- package/dist/types/cli/core-tools/monitor-tool-service.d.ts +6 -0
- package/dist/types/cli/core-tools/registry.d.ts +9 -0
- package/dist/types/cli/core-tools/team-tool-bootstrap.d.ts +7 -0
- package/dist/types/cli/core-tools/team-tool-service.d.ts +21 -0
- package/dist/types/cli/core-tools/utility-tool-bootstrap.d.ts +8 -0
- package/dist/types/cli/default-project-bootstrap.d.ts +8 -0
- package/dist/types/cli/dev-tool-bootstrap.d.ts +4 -0
- package/dist/types/cli/dev-tools/lsp-tool-service.d.ts +5 -0
- package/dist/types/cli/dev-tools/repl-lsp-tool-services.test.d.ts +1 -0
- package/dist/types/cli/dev-tools/repl-tool-service.d.ts +5 -0
- package/dist/types/cli/dream-host-adapter.d.ts +19 -0
- package/dist/types/cli/handlers/agents-handler.d.ts +28 -14
- package/dist/types/cli/handlers/community-handler.d.ts +25 -0
- package/dist/types/cli/handlers/community-handler.test.d.ts +1 -0
- package/dist/types/cli/handlers/config-handler.d.ts +15 -9
- package/dist/types/cli/handlers/config-handler.test.d.ts +1 -0
- package/dist/types/cli/handlers/control-handler.d.ts +23 -0
- package/dist/types/cli/handlers/dream-handler.d.ts +21 -1
- package/dist/types/cli/handlers/files-handler.d.ts +15 -9
- package/dist/types/cli/handlers/files-handler.instructions.test.d.ts +1 -0
- package/dist/types/cli/handlers/media-handler.d.ts +10 -4
- package/dist/types/cli/handlers/media-handler.test.d.ts +1 -0
- package/dist/types/cli/handlers/memory-handler.d.ts +39 -12
- package/dist/types/cli/handlers/pet-confirm-handler.d.ts +7 -0
- package/dist/types/cli/handlers/pet-handler.d.ts +29 -4
- package/dist/types/cli/handlers/pet-handler.test.d.ts +1 -0
- package/dist/types/cli/handlers/product-handler.d.ts +40 -14
- package/dist/types/cli/handlers/project-handler.d.ts +23 -14
- package/dist/types/cli/handlers/session-handler.d.ts +36 -17
- package/dist/types/cli/handlers/session-handler.resume.test.d.ts +1 -0
- package/dist/types/cli/handlers/settings-handler.d.ts +16 -12
- package/dist/types/cli/handlers/skills-handler.d.ts +19 -10
- package/dist/types/cli/handlers/skills-handler.profile.test.d.ts +1 -0
- package/dist/types/cli/handlers/solo-handler.d.ts +31 -9
- package/dist/types/cli/handlers/turn-handler.approval.test.d.ts +1 -0
- package/dist/types/cli/handlers/turn-handler.d.ts +17 -11
- package/dist/types/cli/idle-dream-coordinator.d.ts +46 -0
- package/dist/types/cli/idle-dream-coordinator.test.d.ts +1 -0
- package/dist/types/cli/mcp-plugin-bootstrap.d.ts +27 -0
- package/dist/types/cli/mcp-plugin-bootstrap.test.d.ts +1 -0
- package/dist/types/cli/mcp-tool-proxy.d.ts +7 -0
- package/dist/types/cli/media-file-api-service.d.ts +73 -0
- package/dist/types/cli/media-file-api-service.test.d.ts +1 -0
- package/dist/types/cli/media-file-tool-service.d.ts +13 -0
- package/dist/types/cli/memory-coordinator.d.ts +36 -0
- package/dist/types/cli/model-client-resolver.d.ts +22 -0
- package/dist/types/cli/multi-agent-handler-host.d.ts +27 -0
- package/dist/types/cli/multi-agent-handler-host.test.d.ts +1 -0
- package/dist/types/cli/multi-agent-state-coordinator.d.ts +11 -0
- package/dist/types/cli/permission-bootstrap.d.ts +33 -0
- package/dist/types/cli/permission-bootstrap.test.d.ts +1 -0
- package/dist/types/cli/permission-settings-store.d.ts +2 -0
- package/dist/types/cli/permission-settings-store.test.d.ts +1 -0
- package/dist/types/cli/pet-confirm-coordinator.d.ts +20 -0
- package/dist/types/cli/pet-confirm-coordinator.test.d.ts +1 -0
- package/dist/types/cli/pet-runtime.d.ts +34 -0
- package/dist/types/cli/pet-runtime.test.d.ts +1 -0
- package/dist/types/cli/project-context.d.ts +1 -0
- package/dist/types/cli/project-memory-store-factory.d.ts +2 -0
- package/dist/types/cli/project-template-seeder.d.ts +5 -0
- package/dist/types/cli/provider-core-facade.d.ts +27 -0
- package/dist/types/cli/rpc-registry.community.test.d.ts +1 -0
- package/dist/types/cli/rpc-registry.d.ts +8 -0
- package/dist/types/cli/runtime-hook-bootstrap.d.ts +34 -0
- package/dist/types/cli/runtime-watcher-bootstrap.d.ts +15 -0
- package/dist/types/cli/session-coordinator.d.ts +10 -0
- package/dist/types/cli/session-coordinator.test.d.ts +1 -0
- package/dist/types/cli/session-history-coordinator.d.ts +11 -0
- package/dist/types/cli/session-history-coordinator.test.d.ts +1 -0
- package/dist/types/cli/skill-meta-tool-bootstrap.d.ts +25 -0
- package/dist/types/cli/skill-meta-tool-bootstrap.test.d.ts +1 -0
- package/dist/types/cli/stdio-server.d.ts +17 -134
- package/dist/types/cli/tool-bootstrap.d.ts +1 -4
- package/dist/types/cli/tool-bootstrap.instructions.test.d.ts +1 -0
- package/dist/types/cli/tool-bootstrap.media-provider-alias.test.d.ts +1 -0
- package/dist/types/cli/tool-catalog.d.ts +2 -0
- package/dist/types/cli/tool-invoker-factory.d.ts +10 -0
- package/dist/types/cli/tool-result-processor.d.ts +14 -0
- package/dist/types/cli/transport.d.ts +2 -12
- package/dist/types/cli/turn-ask-user-setup.d.ts +9 -0
- package/dist/types/cli/turn-event-forwarder.d.ts +10 -0
- package/dist/types/cli/turn-lifecycle.d.ts +19 -0
- package/dist/types/cli/turn-lifecycle.test.d.ts +1 -0
- package/dist/types/cli/turn-media-setup.d.ts +16 -0
- package/dist/types/cli/turn-permission-sync.d.ts +7 -0
- package/dist/types/cli/turn-permission-sync.test.d.ts +1 -0
- package/dist/types/cli/turn-project-router.d.ts +22 -0
- package/dist/types/cli/turn-project-router.test.d.ts +1 -0
- package/dist/types/cli/turn-skill-autopersist.d.ts +47 -0
- package/dist/types/cli/turn-skill-autopersist.test.d.ts +1 -0
- package/dist/types/cli/turn-suggestion-generator.d.ts +15 -0
- package/dist/types/orchestration/agent-instance.d.ts +1 -1
- package/dist/types/orchestration/dag-scheduler.d.ts +135 -86
- package/dist/types/orchestration/index.d.ts +2 -2
- package/dist/types/orchestration/product-budget.d.ts +1 -1
- package/dist/types/orchestration/product-persistence.d.ts +3 -12
- package/dist/types/orchestration/product-planner.d.ts +1 -1
- package/dist/types/orchestration/skill-improvement.d.ts +1 -1
- package/dist/types/orchestration/solo-evaluator.d.ts +1 -1
- package/dist/types/orchestration/solo-persistence.d.ts +1 -1
- package/dist/types/orchestration/subagent/fork-subagent.d.ts +1 -1
- package/dist/types/orchestration/subagent/task-types.d.ts +1 -146
- package/dist/types/orchestration/tool-cascade.d.ts +2 -2
- package/dist/types/orchestration/workflow/budget-permission-gate.d.ts +85 -0
- package/dist/types/orchestration/workflow/builtin-executors.d.ts +12 -0
- package/dist/types/orchestration/workflow/cron-schedule.d.ts +37 -0
- package/dist/types/orchestration/workflow/data-item.d.ts +39 -0
- package/dist/types/orchestration/workflow/expression.d.ts +52 -0
- package/dist/types/orchestration/workflow/host-executors.d.ts +15 -0
- package/dist/types/orchestration/workflow/n8n-import.d.ts +35 -0
- package/dist/types/orchestration/workflow/node-registry.d.ts +19 -0
- package/dist/types/orchestration/workflow/node-schema.d.ts +119 -0
- package/dist/types/orchestration/workflow/qla-executor-host.d.ts +42 -0
- package/dist/types/orchestration/workflow/run-checkpoint-store.d.ts +53 -0
- package/dist/types/orchestration/workflow/trigger-validation.d.ts +22 -0
- package/dist/types/orchestration/workflow/workflow-controller.d.ts +143 -0
- package/dist/types/orchestration/workflow/workflow-patch.d.ts +101 -0
- package/dist/types/orchestration/workflow/workflow-render.d.ts +41 -0
- package/dist/types/orchestration/workflow/workflow-runtime.d.ts +127 -0
- package/dist/types/orchestration/workflow/workflow-scheduler.d.ts +83 -0
- package/dist/types/orchestration/workflow/workflow-store.d.ts +40 -0
- package/dist/types/orchestration/workflow/workflow-trigger.d.ts +14 -0
- package/dist/types/permissions.d.ts +2 -0
- package/dist/types/permissions.public-api.test.d.ts +1 -0
- package/dist/types/protocol/methods.d.ts +262 -11
- package/dist/types/{runtime/infra/acp-types.d.ts → protocol/wire/acp-agent-management.d.ts} +3 -3
- package/dist/types/protocol/wire/agent-methods.d.ts +15 -11
- package/dist/types/protocol/wire/agent-rpc.d.ts +11 -0
- package/dist/types/protocol/wire/chat-types.d.ts +9 -0
- package/dist/types/protocol/wire/gateway-rpc.d.ts +13 -0
- package/dist/types/protocol/wire/index.d.ts +2 -1
- package/dist/types/protocol/wire/notification-payloads.d.ts +18 -3
- package/dist/types/runtime/community/community-consent-client.d.ts +117 -0
- package/dist/types/runtime/community/community-consent-client.test.d.ts +1 -0
- package/dist/types/runtime/community/community-desensitization-red-team-cli.d.ts +7 -0
- package/dist/types/runtime/community/community-desensitization-red-team-cli.test.d.ts +1 -0
- package/dist/types/runtime/community/community-desensitization.d.ts +29 -0
- package/dist/types/runtime/community/community-desensitization.test.d.ts +1 -0
- package/dist/types/runtime/community/community-telemetry-recorder.d.ts +6 -0
- package/dist/types/runtime/config/tunable-defaults.d.ts +249 -0
- package/dist/types/runtime/execution/dream-agent.d.ts +4 -2
- package/dist/types/runtime/execution/dream-category-context.d.ts +1 -1
- package/dist/types/runtime/execution/forked-agent.d.ts +3 -1
- package/dist/types/runtime/execution/streaming-tool-executor.d.ts +4 -2
- package/dist/types/runtime/execution/tool-eligibility.d.ts +1 -1
- package/dist/types/runtime/hooks/context-compression.d.ts +2 -2
- package/dist/types/runtime/hooks/memory-hooks.d.ts +6 -6
- package/dist/types/runtime/infra/acp-detector.d.ts +2 -2
- package/dist/types/runtime/infra/acp-protocol-adapter.d.ts +1 -1
- package/dist/types/runtime/infra/acp-usage-tracker.d.ts +1 -1
- package/dist/types/runtime/infra/agent-config-store.d.ts +2 -2
- package/dist/types/runtime/infra/agent-paths.d.ts +18 -10
- package/dist/types/runtime/infra/agent-paths.test.d.ts +1 -0
- package/dist/types/runtime/infra/agent-process.d.ts +2 -2
- package/dist/types/runtime/infra/checkpoint-backend.d.ts +2 -2
- package/dist/types/runtime/infra/index.d.ts +1 -1
- package/dist/types/runtime/infra/llmrouter-catalog.d.ts +10 -0
- package/dist/types/runtime/infra/mcp-bridge.d.ts +1 -1
- package/dist/types/runtime/infra/model-registry.d.ts +2 -1
- package/dist/types/runtime/infra/profile-storage.test.d.ts +1 -0
- package/dist/types/runtime/infra/skill-injector.d.ts +3 -2
- package/dist/types/runtime/infra/skill-injector.test.d.ts +1 -0
- package/dist/types/runtime/infra/task-runtime.d.ts +1 -1
- package/dist/types/runtime/infra/worktree-backend.d.ts +2 -2
- package/dist/types/runtime/memory/categories.d.ts +5 -0
- package/dist/types/runtime/memory/find-relevant-memories.d.ts +70 -0
- package/dist/types/runtime/memory/implicit-extraction.d.ts +58 -0
- package/dist/types/runtime/memory/recall-category-filter.d.ts +54 -0
- package/dist/types/runtime/pet/index.d.ts +1 -1
- package/dist/types/runtime/pet/pet-growth-engine.d.ts +10 -9
- package/dist/types/runtime/pet/pet-growth-engine.test.d.ts +1 -0
- package/dist/types/runtime/pet/pet-soul-service.d.ts +1 -2
- package/dist/types/runtime/pet/pet-soul-service.test.d.ts +1 -0
- package/dist/types/runtime/ports/agent-execution-contracts.d.ts +182 -0
- package/dist/types/runtime/ports/checkpoint-contracts.d.ts +19 -0
- package/dist/types/runtime/ports/index.d.ts +13 -0
- package/dist/types/runtime/ports/memory-provider.d.ts +146 -0
- package/dist/types/runtime/ports/memory-recall-source.d.ts +3 -0
- package/dist/types/runtime/ports/memory-writer.d.ts +21 -0
- package/dist/types/runtime/ports/path-service.d.ts +5 -0
- package/dist/types/runtime/ports/permission-contracts.d.ts +107 -0
- package/dist/types/runtime/ports/project-memory-store.d.ts +44 -0
- package/dist/types/runtime/ports/tool-call-contracts.d.ts +16 -0
- package/dist/types/runtime/ports/tool-contracts.d.ts +23 -0
- package/dist/types/runtime/ports/web-search-contracts.d.ts +17 -0
- package/dist/types/runtime/ports/worktree-contracts.d.ts +22 -0
- package/dist/types/runtime/prompt/environment-context.test.d.ts +1 -0
- package/dist/types/runtime/prompt/fresh-workspace-evidence.d.ts +19 -0
- package/dist/types/runtime/prompt/fresh-workspace-evidence.test.d.ts +1 -0
- package/dist/types/runtime/prompt/instruction-loader.d.ts +9 -3
- package/dist/types/runtime/prompt/instruction-loader.test.d.ts +1 -0
- package/dist/types/runtime/session/session-persistence.test.d.ts +1 -0
- package/dist/types/runtime/tasks/task-types.d.ts +146 -0
- package/dist/types/skills/index.d.ts +2 -2
- package/dist/types/skills/mcp/mcp-http-client.d.ts +2 -0
- package/dist/types/skills/mcp/mcp-manager.d.ts +7 -4
- package/dist/types/skills/mcp/mcp-stdio-client.d.ts +2 -0
- package/dist/types/skills/mcp/mcp-tool-metadata.d.ts +18 -0
- package/dist/types/skills/memory/categories.d.ts +1 -5
- package/dist/types/skills/memory/find-relevant-memories.d.ts +1 -70
- package/dist/types/skills/memory/implicit-extraction.d.ts +1 -58
- package/dist/types/skills/memory/local-memory-provider.d.ts +6 -10
- package/dist/types/skills/memory/local-store.d.ts +4 -4
- package/dist/types/skills/memory/memory-consolidation.d.ts +9 -1
- package/dist/types/skills/memory/memory-provider-factory.d.ts +2 -0
- package/dist/types/skills/memory/memory-tool.d.ts +4 -6
- package/dist/types/skills/memory/recall-category-filter.d.ts +1 -54
- package/dist/types/skills/permissions/community-sandbox-policy.d.ts +3 -0
- package/dist/types/skills/permissions/community-sandbox-red-team-cli.d.ts +7 -0
- package/dist/types/skills/permissions/community-sandbox-red-team.d.ts +30 -0
- package/dist/types/skills/permissions/hook-runner.d.ts +15 -2
- package/dist/types/skills/permissions/settings-watcher.d.ts +2 -0
- package/dist/types/skills/permissions/types.d.ts +2 -113
- package/dist/types/skills/portable-tool.d.ts +22 -0
- package/dist/types/skills/skill-system/skill-lifecycle.d.ts +5 -0
- package/dist/types/skills/skill-system/skill-source.d.ts +2 -148
- package/dist/types/skills/tool-access.d.ts +30 -0
- package/dist/types/skills/tools/skill-tool.d.ts +2 -10
- package/dist/types/skills/tools/web-search-tool.d.ts +3 -20
- package/dist/types/skills/tools.d.ts +1 -1
- package/dist/types/transport/acp-server.d.ts +1 -1
- package/dist/types/transport/index.d.ts +1 -0
- package/dist/types/transport/io-transport.d.ts +19 -0
- package/package.json +93 -80
- package/dist/types/llm/index.d.ts +0 -1
- /package/dist/types/{orchestration/context/context-compression.d.ts → runtime/context/context-compression-strategies.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* Architecture note: CC uses React-style setAppState(prev => next). We use
|
|
10
10
|
* a simple Map-based store since we're in a subprocess (no React).
|
|
11
11
|
*/
|
|
12
|
-
import type { TaskState, TaskType, TaskLifecycle, PermissionRole, IsolationMode, LocalAgentTaskState, LocalBashTaskState } from "
|
|
12
|
+
import type { TaskState, TaskType, TaskLifecycle, PermissionRole, IsolationMode, LocalAgentTaskState, LocalBashTaskState } from "../tasks/task-types.js";
|
|
13
13
|
import type { HookRegistry } from "../../contracts/hooks.js";
|
|
14
14
|
/** Polling interval for running tasks (ms) */
|
|
15
15
|
export declare const POLL_INTERVAL_MS = 1000;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*
|
|
18
18
|
* Security: validateWorktreeSlug() prevents path traversal.
|
|
19
19
|
*/
|
|
20
|
-
import type {
|
|
20
|
+
import type { WorktreeBackend } from "../ports/worktree-contracts.js";
|
|
21
21
|
interface WorktreeSession {
|
|
22
22
|
originalCwd: string;
|
|
23
23
|
worktreePath: string;
|
|
@@ -82,5 +82,5 @@ export interface WorktreeBackendOptions {
|
|
|
82
82
|
/** Sparse-checkout paths (CC settings.worktree.sparsePaths parity). */
|
|
83
83
|
sparsePaths?: string[];
|
|
84
84
|
}
|
|
85
|
-
export declare function createWorktreeBackend(opts: WorktreeBackendOptions):
|
|
85
|
+
export declare function createWorktreeBackend(opts: WorktreeBackendOptions): WorktreeBackend;
|
|
86
86
|
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export declare const RELEVANT_MEMORIES_CONFIG: {
|
|
2
|
+
/** Max topic files to consider during scan. */
|
|
3
|
+
readonly MAX_SCAN_FILES: 100;
|
|
4
|
+
/** Max files to surface per turn. */
|
|
5
|
+
readonly MAX_SELECTED: 5;
|
|
6
|
+
/** Max bytes per surfaced file (CC: 4096). */
|
|
7
|
+
readonly MAX_FILE_BYTES: 4096;
|
|
8
|
+
/** Max total bytes for all surfaced files combined. */
|
|
9
|
+
readonly MAX_TOTAL_BYTES: number;
|
|
10
|
+
/** Minimum score to be selected (0.0-1.0). */
|
|
11
|
+
readonly MIN_SCORE: 0.2;
|
|
12
|
+
/** Lines to read for header/description extraction. */
|
|
13
|
+
readonly HEADER_LINES: 10;
|
|
14
|
+
/** Recency boost: files modified within this many days get a bonus. */
|
|
15
|
+
readonly RECENCY_DAYS: 7;
|
|
16
|
+
/** Recency boost amount. */
|
|
17
|
+
readonly RECENCY_BOOST: 0.15;
|
|
18
|
+
};
|
|
19
|
+
/** Scanned memory file header (CC MemoryHeader parity). */
|
|
20
|
+
export interface MemoryFileHeader {
|
|
21
|
+
/** Filename (e.g. "lesson-docker.md") */
|
|
22
|
+
filename: string;
|
|
23
|
+
/** Absolute path */
|
|
24
|
+
filePath: string;
|
|
25
|
+
/** Last modified timestamp (ms since epoch) */
|
|
26
|
+
mtimeMs: number;
|
|
27
|
+
/** File size in bytes */
|
|
28
|
+
sizeBytes: number;
|
|
29
|
+
/** Description extracted from first non-heading line */
|
|
30
|
+
description: string | null;
|
|
31
|
+
/** Category inferred from filename prefix */
|
|
32
|
+
category: string | null;
|
|
33
|
+
}
|
|
34
|
+
/** A selected relevant memory with content loaded. */
|
|
35
|
+
export interface RelevantMemory {
|
|
36
|
+
/** Filename */
|
|
37
|
+
filename: string;
|
|
38
|
+
/** Full file path */
|
|
39
|
+
filePath: string;
|
|
40
|
+
/** Last modified timestamp */
|
|
41
|
+
mtimeMs: number;
|
|
42
|
+
/** Relevance score (0.0 - 1.0) */
|
|
43
|
+
score: number;
|
|
44
|
+
/** Content (possibly truncated) */
|
|
45
|
+
content: string;
|
|
46
|
+
/** Whether content was truncated */
|
|
47
|
+
truncated: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Find memory files relevant to a user query.
|
|
51
|
+
*
|
|
52
|
+
* CC parity: scans topic files, scores by keyword + filename + recency,
|
|
53
|
+
* selects top-N, loads content. No LLM needed (unlike CC's Sonnet call).
|
|
54
|
+
*
|
|
55
|
+
* @param query - User query text
|
|
56
|
+
* @param memoryDir - Root of the MEMDIR directory (~/.qlogicagent/memory/)
|
|
57
|
+
* @param alreadySurfaced - Paths already shown in prior turns (for dedup)
|
|
58
|
+
* @returns Relevant memories with content, sorted by score
|
|
59
|
+
*/
|
|
60
|
+
export declare function findRelevantMemories(query: string, memoryDir: string, alreadySurfaced?: ReadonlySet<string>): Promise<RelevantMemory[]>;
|
|
61
|
+
/**
|
|
62
|
+
* Scan memory directory for topic files (excludes INDEX.md).
|
|
63
|
+
* Returns headers sorted by modification time (newest first).
|
|
64
|
+
*/
|
|
65
|
+
export declare function scanMemoryHeaders(memoryDir: string): Promise<MemoryFileHeader[]>;
|
|
66
|
+
/**
|
|
67
|
+
* Format relevant memories as a single block for system prompt injection.
|
|
68
|
+
* CC parity: includes freshness header per file.
|
|
69
|
+
*/
|
|
70
|
+
export declare function formatRelevantMemoriesBlock(memories: RelevantMemory[]): string;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implicit Memory Extraction — CC extractMemories lightweight port.
|
|
3
|
+
*
|
|
4
|
+
* Architecture:
|
|
5
|
+
* Layer 1: Zero-cost signal detection (regex) — decides if turn has extractable content
|
|
6
|
+
* Layer 2: Lightweight LLM pass (async, non-blocking) — extracts structured facts
|
|
7
|
+
*
|
|
8
|
+
* This runs AFTER turn.end, so the user already has their response.
|
|
9
|
+
* Layer 2 only fires for ~10-20% of turns (those with detectable signals).
|
|
10
|
+
*
|
|
11
|
+
* Reference: claude-code src/services/extractMemories/extractMemories.ts
|
|
12
|
+
*/
|
|
13
|
+
import type { MemoryWriter } from "../ports/memory-writer.js";
|
|
14
|
+
export interface ExtractedFact {
|
|
15
|
+
text: string;
|
|
16
|
+
category: "personal_fact" | "preference" | "event" | "lesson" | "pattern" | "decision";
|
|
17
|
+
importance: number;
|
|
18
|
+
eventDate?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ImplicitExtractionDeps {
|
|
21
|
+
/** Local memory provider for writing extracted facts. */
|
|
22
|
+
localProvider: MemoryWriter;
|
|
23
|
+
/** User ID. */
|
|
24
|
+
userId: string;
|
|
25
|
+
/** Logger. */
|
|
26
|
+
log: {
|
|
27
|
+
debug(msg: string): void;
|
|
28
|
+
warn(msg: string): void;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* LLM invocation function (uses background/cheap model).
|
|
32
|
+
* Returns structured JSON string or null if unavailable.
|
|
33
|
+
*/
|
|
34
|
+
llmExtract?: (prompt: string) => Promise<string | null>;
|
|
35
|
+
}
|
|
36
|
+
export interface TurnPair {
|
|
37
|
+
userMessage: string;
|
|
38
|
+
assistantMessage: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Layer 1: Detect if a user message contains signals worth extracting.
|
|
42
|
+
* Zero LLM cost — pure regex scanning.
|
|
43
|
+
*
|
|
44
|
+
* @returns true if the message likely contains extractable personal facts/events
|
|
45
|
+
*/
|
|
46
|
+
export declare function hasExtractionSignal(userMessage: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Layer 2: Use a lightweight LLM to extract structured facts from a turn pair.
|
|
49
|
+
* Only called when Layer 1 signals are detected.
|
|
50
|
+
*/
|
|
51
|
+
export declare function extractFactsViaLlm(turn: TurnPair, llmExtract: (prompt: string) => Promise<string | null>, today: string): Promise<ExtractedFact[]>;
|
|
52
|
+
/**
|
|
53
|
+
* Run the full implicit extraction pipeline for a completed turn.
|
|
54
|
+
* This is async and non-blocking — call it after turn.end.
|
|
55
|
+
*
|
|
56
|
+
* @returns Number of facts extracted and stored
|
|
57
|
+
*/
|
|
58
|
+
export declare function runImplicitExtraction(turn: TurnPair, deps: ImplicitExtractionDeps): Promise<number>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { QMemoryCategory } from "./categories.js";
|
|
2
|
+
/** Detected query scenario with preferred categories. */
|
|
3
|
+
export interface RecallCategoryHint {
|
|
4
|
+
/** Detected scenario label. */
|
|
5
|
+
scenario: QueryScenario;
|
|
6
|
+
/** Preferred categories for this scenario (ordered by priority). */
|
|
7
|
+
preferred: QMemoryCategory[];
|
|
8
|
+
/** Categories to deprioritize (still recalled but scored lower). */
|
|
9
|
+
deprioritized: QMemoryCategory[];
|
|
10
|
+
/** Confidence of scenario detection (0.0-1.0). */
|
|
11
|
+
confidence: number;
|
|
12
|
+
}
|
|
13
|
+
/** Known query scenarios. */
|
|
14
|
+
export type QueryScenario = "coding" | "config" | "conversation" | "learning" | "decision" | "general";
|
|
15
|
+
/**
|
|
16
|
+
* Detect the query scenario and return category preferences.
|
|
17
|
+
*
|
|
18
|
+
* Uses pattern matching on the user query to infer intent.
|
|
19
|
+
* Returns "general" (no filtering) when confidence is below threshold.
|
|
20
|
+
*
|
|
21
|
+
* @param query - User query text
|
|
22
|
+
* @returns Category hint with preferred/deprioritized categories
|
|
23
|
+
*/
|
|
24
|
+
export declare function detectRecallCategories(query: string): RecallCategoryHint;
|
|
25
|
+
/**
|
|
26
|
+
* Apply category boost/penalty to a recall score.
|
|
27
|
+
*
|
|
28
|
+
* Used by recall hooks to adjust memory scores based on category alignment.
|
|
29
|
+
*
|
|
30
|
+
* @param baseScore - Original relevance score (0.0-1.0)
|
|
31
|
+
* @param memoryCategory - Category of the memory entry (if known)
|
|
32
|
+
* @param hint - Category hint from detectRecallCategories()
|
|
33
|
+
* @returns Adjusted score
|
|
34
|
+
*/
|
|
35
|
+
export declare function applyCategoryBoost(baseScore: number, memoryCategory: string | undefined | null, hint: RecallCategoryHint): number;
|
|
36
|
+
/**
|
|
37
|
+
* Filter and re-rank a list of recalled memories based on category preferences.
|
|
38
|
+
*
|
|
39
|
+
* @param memories - Raw recalled memories with optional category
|
|
40
|
+
* @param hint - Category hint from detectRecallCategories()
|
|
41
|
+
* @param minScore - Minimum adjusted score to keep (default: 0)
|
|
42
|
+
* @returns Re-ranked memories (highest adjusted score first)
|
|
43
|
+
*/
|
|
44
|
+
export declare function filterByCategory<T extends {
|
|
45
|
+
score?: number;
|
|
46
|
+
category?: string | null;
|
|
47
|
+
}>(memories: T[], hint: RecallCategoryHint, minScore?: number): T[];
|
|
48
|
+
/**
|
|
49
|
+
* Infer memory category from filename prefix convention.
|
|
50
|
+
* E.g. "lesson-docker.md" → "lesson", "fact-ports.md" → "fact"
|
|
51
|
+
*
|
|
52
|
+
* Exported for use by recall hooks.
|
|
53
|
+
*/
|
|
54
|
+
export declare function inferCategoryFromFilename(filename: string): QMemoryCategory | null;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export { PetSoulService, type PetSoul, type PetStats, type PetBreed } from "./pet-soul-service.js";
|
|
5
5
|
export { maybeGenerateReaction, generateLLMReaction, type ReactionPool, type LLMReactionContext, type ReactionStyle } from "./pet-reaction-service.js";
|
|
6
|
-
export { PetGrowthEngine, type GrowthEvent, type MoltResult, type
|
|
6
|
+
export { PetGrowthEngine, type GrowthEvent, type MoltResult, type PetDisplayTrait } from "./pet-growth-engine.js";
|
|
7
7
|
export { loadPetFile, validatePetManifest, sanitizeSvg, type PetManifest, type PetFileBundle } from "./pet-file-loader.js";
|
|
8
8
|
export { buildSkeletonPrompt, parseSkeleton, renderState, extractColors, validateSkeleton, STATE_ANIMATION_MAP, type PetSkeleton, type SkeletonPart, type StateAnimationParams } from "./pet-skeleton.js";
|
|
9
9
|
export { evaluateConsistency, evaluateConsistencyWithVision, structuralConsistencyScore, buildConsistencyPrompt, parseConsistencyResponse, buildRetryPrompt, DEFAULT_THRESHOLD, DEFAULT_MAX_RETRIES, type ConsistencyResult, type ConsistencyReport, type ConsistencyOptions } from "./pet-consistency.js";
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* PetGrowthEngine — handles pet leveling, molting
|
|
2
|
+
* PetGrowthEngine — handles pet leveling, molting, and display-trait unlocks.
|
|
3
3
|
*
|
|
4
4
|
* Design §13: Growth system
|
|
5
5
|
* - XP curve: level * 100 (linear P0, polynomial later)
|
|
6
6
|
* - Molting: every 5 levels triggers a "molt" event with visual upgrade
|
|
7
|
-
* -
|
|
7
|
+
* - Display traits: unlocked at specific levels, presentation-only
|
|
8
8
|
* - Stats growth: each level-up slightly boosts one stat
|
|
9
9
|
*/
|
|
10
10
|
import type { PetStats, PetSoul } from "./pet-soul-service.js";
|
|
11
|
-
export interface
|
|
11
|
+
export interface PetDisplayTrait {
|
|
12
12
|
id: string;
|
|
13
13
|
name: string;
|
|
14
14
|
description: string;
|
|
15
15
|
unlockedAtLevel: number;
|
|
16
|
+
surface: "presentation";
|
|
16
17
|
}
|
|
17
18
|
export interface GrowthEvent {
|
|
18
|
-
type: "level_up" | "molt" | "
|
|
19
|
+
type: "level_up" | "molt" | "display_trait_unlock";
|
|
19
20
|
level: number;
|
|
20
|
-
|
|
21
|
+
displayTrait?: PetDisplayTrait;
|
|
21
22
|
moltStage?: number;
|
|
22
23
|
}
|
|
23
24
|
export interface MoltResult {
|
|
@@ -46,13 +47,13 @@ export declare class PetGrowthEngine {
|
|
|
46
47
|
*/
|
|
47
48
|
static getMoltResult(stage: number, currentStats: PetStats): MoltResult;
|
|
48
49
|
/**
|
|
49
|
-
* Get all unlocked
|
|
50
|
+
* Get all unlocked presentation traits for a given level.
|
|
50
51
|
*/
|
|
51
|
-
static
|
|
52
|
+
static getUnlockedDisplayTraits(level: number): PetDisplayTrait[];
|
|
52
53
|
/**
|
|
53
|
-
* Get next upcoming
|
|
54
|
+
* Get next upcoming presentation trait.
|
|
54
55
|
*/
|
|
55
|
-
static
|
|
56
|
+
static getNextDisplayTrait(level: number): PetDisplayTrait | null;
|
|
56
57
|
/**
|
|
57
58
|
* XP gain rules for different events.
|
|
58
59
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -31,10 +31,9 @@ export interface PetBreed {
|
|
|
31
31
|
rarity: string;
|
|
32
32
|
}
|
|
33
33
|
export declare class PetSoulService {
|
|
34
|
-
private workspaceDir;
|
|
35
34
|
private soul;
|
|
36
35
|
private storagePath;
|
|
37
|
-
constructor(
|
|
36
|
+
constructor(_workspaceDir: string, ownerUserId?: string);
|
|
38
37
|
load(): PetSoul | null;
|
|
39
38
|
hatch(userId: string, generateSoul?: (rarity: string, stats: PetStats) => Promise<{
|
|
40
39
|
name: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import type { HookRegistry } from "../../contracts/hooks.js";
|
|
2
|
+
import type { ChatMessage as WireChatMessage, ToolDefinition as WireToolDefinition, WireTokenUsage } from "../../protocol/wire/index.js";
|
|
3
|
+
export type ChatMessage = WireChatMessage;
|
|
4
|
+
export type TokenUsage = WireTokenUsage;
|
|
5
|
+
export interface ToolDefinition extends WireToolDefinition {
|
|
6
|
+
backfillObservableInput?: (input: Record<string, unknown>) => void;
|
|
7
|
+
}
|
|
8
|
+
export type TurnEvent = {
|
|
9
|
+
type: "start";
|
|
10
|
+
turnId: string;
|
|
11
|
+
} | {
|
|
12
|
+
type: "delta";
|
|
13
|
+
turnId: string;
|
|
14
|
+
text: string;
|
|
15
|
+
} | {
|
|
16
|
+
type: "tool_call";
|
|
17
|
+
turnId: string;
|
|
18
|
+
callId: string;
|
|
19
|
+
name: string;
|
|
20
|
+
arguments: string;
|
|
21
|
+
inputSummary?: string;
|
|
22
|
+
} | {
|
|
23
|
+
type: "end";
|
|
24
|
+
turnId: string;
|
|
25
|
+
content: string;
|
|
26
|
+
usage?: TokenUsage;
|
|
27
|
+
model?: string;
|
|
28
|
+
provider?: string;
|
|
29
|
+
} | {
|
|
30
|
+
type: "error";
|
|
31
|
+
turnId: string;
|
|
32
|
+
error: string;
|
|
33
|
+
code?: string;
|
|
34
|
+
usage?: TokenUsage;
|
|
35
|
+
} | {
|
|
36
|
+
type: "skill_instruction";
|
|
37
|
+
turnId: string;
|
|
38
|
+
instruction: unknown;
|
|
39
|
+
} | {
|
|
40
|
+
type: "tool_result";
|
|
41
|
+
turnId: string;
|
|
42
|
+
callId: string;
|
|
43
|
+
name: string;
|
|
44
|
+
ok: boolean;
|
|
45
|
+
error?: string;
|
|
46
|
+
outputPreview?: string;
|
|
47
|
+
durationMs?: number;
|
|
48
|
+
exitCode?: number;
|
|
49
|
+
stdout?: string;
|
|
50
|
+
stderr?: string;
|
|
51
|
+
details?: Record<string, unknown>;
|
|
52
|
+
} | {
|
|
53
|
+
type: "tool_blocked";
|
|
54
|
+
turnId: string;
|
|
55
|
+
callId: string;
|
|
56
|
+
name: string;
|
|
57
|
+
reason: string;
|
|
58
|
+
} | {
|
|
59
|
+
type: "recovery";
|
|
60
|
+
turnId: string;
|
|
61
|
+
action: string;
|
|
62
|
+
detail?: string;
|
|
63
|
+
} | {
|
|
64
|
+
type: "plan_update";
|
|
65
|
+
turnId: string;
|
|
66
|
+
slug: string;
|
|
67
|
+
content: string;
|
|
68
|
+
} | {
|
|
69
|
+
type: "heartbeat";
|
|
70
|
+
turnId: string;
|
|
71
|
+
message: string;
|
|
72
|
+
} | {
|
|
73
|
+
type: "tool_use_summary";
|
|
74
|
+
turnId: string;
|
|
75
|
+
summary: string;
|
|
76
|
+
} | {
|
|
77
|
+
type: "reasoning_delta";
|
|
78
|
+
turnId: string;
|
|
79
|
+
text: string;
|
|
80
|
+
} | {
|
|
81
|
+
type: "suggestions";
|
|
82
|
+
turnId: string;
|
|
83
|
+
items: Array<{
|
|
84
|
+
text: string;
|
|
85
|
+
icon?: string;
|
|
86
|
+
action?: string;
|
|
87
|
+
}>;
|
|
88
|
+
} | {
|
|
89
|
+
type: "media_result";
|
|
90
|
+
turnId: string;
|
|
91
|
+
mediaType: "image" | "tts" | "video" | "music";
|
|
92
|
+
url: string;
|
|
93
|
+
model?: string;
|
|
94
|
+
provider?: string;
|
|
95
|
+
durationSeconds?: number;
|
|
96
|
+
width?: number;
|
|
97
|
+
height?: number;
|
|
98
|
+
mimeType?: string;
|
|
99
|
+
billingUnit?: string;
|
|
100
|
+
billingQuantity?: number;
|
|
101
|
+
taskId?: string;
|
|
102
|
+
} | {
|
|
103
|
+
type: "artifact";
|
|
104
|
+
turnId: string;
|
|
105
|
+
artifactId: string;
|
|
106
|
+
artifactType: "code" | "file" | "image" | "document" | "diagram" | "table";
|
|
107
|
+
title: string;
|
|
108
|
+
filePath?: string;
|
|
109
|
+
language?: string;
|
|
110
|
+
content?: string;
|
|
111
|
+
mimeType?: string;
|
|
112
|
+
} | {
|
|
113
|
+
type: "annotations";
|
|
114
|
+
turnId: string;
|
|
115
|
+
annotations: Array<{
|
|
116
|
+
type: string;
|
|
117
|
+
url?: string;
|
|
118
|
+
title?: string;
|
|
119
|
+
[key: string]: unknown;
|
|
120
|
+
}>;
|
|
121
|
+
} | {
|
|
122
|
+
type: "subagent_started";
|
|
123
|
+
turnId: string;
|
|
124
|
+
subagentId: string;
|
|
125
|
+
agentType: string;
|
|
126
|
+
prompt?: string;
|
|
127
|
+
} | {
|
|
128
|
+
type: "subagent_ended";
|
|
129
|
+
turnId: string;
|
|
130
|
+
subagentId: string;
|
|
131
|
+
agentType: string;
|
|
132
|
+
ok: boolean;
|
|
133
|
+
outputPreview?: string;
|
|
134
|
+
error?: string;
|
|
135
|
+
};
|
|
136
|
+
export interface ToolInvoker {
|
|
137
|
+
invoke(turnId: string, name: string, args: string, signal?: AbortSignal): Promise<{
|
|
138
|
+
result: string;
|
|
139
|
+
error?: string;
|
|
140
|
+
toolReferences?: string[];
|
|
141
|
+
imageUrls?: string[];
|
|
142
|
+
details?: Record<string, unknown>;
|
|
143
|
+
}>;
|
|
144
|
+
}
|
|
145
|
+
export interface AgentRunRequest {
|
|
146
|
+
turnId: string;
|
|
147
|
+
sessionId: string;
|
|
148
|
+
messages: ChatMessage[];
|
|
149
|
+
tools: ToolDefinition[];
|
|
150
|
+
systemPrompt?: string;
|
|
151
|
+
config?: {
|
|
152
|
+
model?: string;
|
|
153
|
+
apiKey?: string;
|
|
154
|
+
temperature?: number;
|
|
155
|
+
maxOutputTokens?: number;
|
|
156
|
+
parentDepth?: number;
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
export interface ForkedAgentRunner {
|
|
160
|
+
run(request: AgentRunRequest, signal?: AbortSignal): AsyncIterable<TurnEvent>;
|
|
161
|
+
}
|
|
162
|
+
export interface ForkedAgentRunnerFactory {
|
|
163
|
+
(params: {
|
|
164
|
+
transport: unknown;
|
|
165
|
+
apiKey: string;
|
|
166
|
+
toolInvoker: ToolInvoker;
|
|
167
|
+
log: AgentLogger;
|
|
168
|
+
hooks?: HookRegistry;
|
|
169
|
+
maxRounds?: number;
|
|
170
|
+
}): ForkedAgentRunner;
|
|
171
|
+
}
|
|
172
|
+
export interface AgentLogger {
|
|
173
|
+
info(message: string): void;
|
|
174
|
+
info(obj: Record<string, unknown>, message: string): void;
|
|
175
|
+
warn(message: string): void;
|
|
176
|
+
warn(obj: Record<string, unknown>, message: string): void;
|
|
177
|
+
error(message: string): void;
|
|
178
|
+
error(obj: Record<string, unknown>, message: string): void;
|
|
179
|
+
debug(message: string): void;
|
|
180
|
+
debug(obj: Record<string, unknown>, message: string): void;
|
|
181
|
+
}
|
|
182
|
+
export type { HookRegistry };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface Checkpoint {
|
|
2
|
+
id: string;
|
|
3
|
+
message: string;
|
|
4
|
+
timestamp: string;
|
|
5
|
+
fileCount: number;
|
|
6
|
+
}
|
|
7
|
+
export interface CheckpointResult {
|
|
8
|
+
success: boolean;
|
|
9
|
+
checkpoint?: Checkpoint;
|
|
10
|
+
checkpoints?: Checkpoint[];
|
|
11
|
+
diff?: string;
|
|
12
|
+
error?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface CheckpointBackend {
|
|
15
|
+
createCheckpoint(message?: string): Promise<CheckpointResult>;
|
|
16
|
+
listCheckpoints(): Promise<CheckpointResult>;
|
|
17
|
+
restoreCheckpoint(checkpointId: string, paths?: string[]): Promise<CheckpointResult>;
|
|
18
|
+
diffCheckpoint(checkpointId: string): Promise<CheckpointResult>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type { MemoryWriter, MemoryWriteMetadata } from "./memory-writer.js";
|
|
2
|
+
export type { MemoryRecallSource } from "./memory-recall-source.js";
|
|
3
|
+
export type { MemoryProvider, MemorySearchOptions, MemorySearchResult, MemoryIngestMessage, MemoryIngestOptions, MemoryExtractionItem, MemoryConsolidationWriteResult, MemoryLearningSink, MemoryToolLocalProvider, MemoryActivitySummary, MemoryAtlasRecord, MemoryAtlasResult, MemoryUpdatePatch, MemoryHandlerProvider, MemoryDreamProvider, MemoryDecayProvider, MemoryRuntimeHookProvider, MemoryToolProvider, MemoryDreamRuntimeProvider, } from "./memory-provider.js";
|
|
4
|
+
export type { PathService } from "./path-service.js";
|
|
5
|
+
export { PERMISSION_MODES, } from "./permission-contracts.js";
|
|
6
|
+
export type { ApprovalRequest, ApprovalResponse, PermissionApprovalResolver, PermissionBehavior, PermissionConfig, PermissionDecisionReason, PermissionMetadataResolver, PermissionMode, PermissionResult, PermissionRuleEnginePort, PermissionRuleEntry, PermissionUpdate, ToolPermissionCheckInput, } from "./permission-contracts.js";
|
|
7
|
+
export type { ProjectMemoryFileInfo, ProjectMemoryResult, ProjectMemoryStore, ProjectMemoryStoreFactory, } from "./project-memory-store.js";
|
|
8
|
+
export type { ToolBootstrap, ToolCatalog } from "./tool-contracts.js";
|
|
9
|
+
export type { Checkpoint, CheckpointBackend, CheckpointResult } from "./checkpoint-contracts.js";
|
|
10
|
+
export type { WorktreeBackend, WorktreeInfo, WorktreeResult } from "./worktree-contracts.js";
|
|
11
|
+
export type { WebSearchBackend, WebSearchOutput, WebSearchResult } from "./web-search-contracts.js";
|
|
12
|
+
export { buildToolResultMessage, type OpenAiToolCall, type ToolResultMessageInput } from "./tool-call-contracts.js";
|
|
13
|
+
export type { AgentLogger, AgentRunRequest, ChatMessage, ForkedAgentRunner, ForkedAgentRunnerFactory, HookRegistry, TokenUsage, ToolDefinition, ToolInvoker, TurnEvent, } from "./agent-execution-contracts.js";
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { MemoryWriter } from "./memory-writer.js";
|
|
2
|
+
export interface MemorySearchOptions {
|
|
3
|
+
limit?: number;
|
|
4
|
+
minScore?: number;
|
|
5
|
+
preferredCategories?: string[];
|
|
6
|
+
llmConfig?: unknown;
|
|
7
|
+
}
|
|
8
|
+
export interface MemorySearchResult {
|
|
9
|
+
blockId: string;
|
|
10
|
+
id?: string;
|
|
11
|
+
path?: string;
|
|
12
|
+
text: string;
|
|
13
|
+
content?: string;
|
|
14
|
+
score: number;
|
|
15
|
+
source?: string;
|
|
16
|
+
metadata?: Record<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
export interface MemoryIngestMessage {
|
|
19
|
+
role: string;
|
|
20
|
+
content: string;
|
|
21
|
+
timestamp?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface MemoryIngestOptions {
|
|
24
|
+
llmConfig?: unknown;
|
|
25
|
+
source?: string;
|
|
26
|
+
sessionId?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface MemoryExtractionItem {
|
|
29
|
+
text: string;
|
|
30
|
+
category?: string;
|
|
31
|
+
importance?: number;
|
|
32
|
+
confidence?: number;
|
|
33
|
+
source?: string;
|
|
34
|
+
event_date?: string;
|
|
35
|
+
tags?: string[];
|
|
36
|
+
}
|
|
37
|
+
export interface MemoryConsolidationWriteResult {
|
|
38
|
+
memoriesAdded?: number;
|
|
39
|
+
observationsAdded?: number;
|
|
40
|
+
proposalsAdded?: number;
|
|
41
|
+
claimsAdded?: number;
|
|
42
|
+
conflictsAdded?: number;
|
|
43
|
+
claimIds?: string[];
|
|
44
|
+
conflictIds?: string[];
|
|
45
|
+
}
|
|
46
|
+
export interface MemoryProvider {
|
|
47
|
+
readonly providerId: string;
|
|
48
|
+
search(query: string, userId: string, options?: MemorySearchOptions): Promise<MemorySearchResult[]>;
|
|
49
|
+
ingest?(messages: MemoryIngestMessage[], userId: string, options?: MemoryIngestOptions): Promise<void>;
|
|
50
|
+
addText?(text: string, userId: string, options?: MemoryIngestOptions): Promise<{
|
|
51
|
+
memoriesAdded: number;
|
|
52
|
+
}>;
|
|
53
|
+
remove?(memoryId: string): Promise<boolean>;
|
|
54
|
+
}
|
|
55
|
+
export interface MemoryLearningSink {
|
|
56
|
+
ingestExtracted(items: MemoryExtractionItem[], userId: string, options?: MemoryIngestOptions): Promise<MemoryConsolidationWriteResult>;
|
|
57
|
+
}
|
|
58
|
+
export interface MemoryToolLocalProvider {
|
|
59
|
+
addText(text: string, userId: string, metadata?: MemoryIngestOptions & {
|
|
60
|
+
category?: string;
|
|
61
|
+
importance?: number;
|
|
62
|
+
}): Promise<unknown>;
|
|
63
|
+
synthesizeTimeline(userId: string, startMs: number, endMs: number): string;
|
|
64
|
+
feedback(ids: string[], signal: "useful" | "irrelevant" | "outdated" | "wrong"): Promise<{
|
|
65
|
+
affected: number;
|
|
66
|
+
}>;
|
|
67
|
+
}
|
|
68
|
+
export interface MemoryActivitySummary {
|
|
69
|
+
dailyCounts: Array<{
|
|
70
|
+
date: string;
|
|
71
|
+
count: number;
|
|
72
|
+
}>;
|
|
73
|
+
highlights: Array<{
|
|
74
|
+
text: string;
|
|
75
|
+
category: string;
|
|
76
|
+
importance: number;
|
|
77
|
+
date: string;
|
|
78
|
+
}>;
|
|
79
|
+
}
|
|
80
|
+
export interface MemoryAtlasRecord {
|
|
81
|
+
id: string;
|
|
82
|
+
text: string;
|
|
83
|
+
category?: string;
|
|
84
|
+
importance?: number;
|
|
85
|
+
confidence?: number;
|
|
86
|
+
source?: string;
|
|
87
|
+
sessionId?: string;
|
|
88
|
+
eventDate?: string;
|
|
89
|
+
tags?: string[];
|
|
90
|
+
createdAt?: string | number;
|
|
91
|
+
updatedAt?: string | number;
|
|
92
|
+
accessCount?: number;
|
|
93
|
+
lastAccessedAt?: string | number;
|
|
94
|
+
isArchived?: boolean;
|
|
95
|
+
}
|
|
96
|
+
export interface MemoryAtlasResult {
|
|
97
|
+
totalCount?: number;
|
|
98
|
+
records?: MemoryAtlasRecord[];
|
|
99
|
+
buckets?: unknown[];
|
|
100
|
+
clusters?: unknown[];
|
|
101
|
+
windowCursor?: unknown;
|
|
102
|
+
timeRange?: unknown;
|
|
103
|
+
}
|
|
104
|
+
export interface MemoryUpdatePatch {
|
|
105
|
+
text?: string;
|
|
106
|
+
category?: string;
|
|
107
|
+
importance?: number;
|
|
108
|
+
source?: string;
|
|
109
|
+
eventDate?: string;
|
|
110
|
+
tags?: string[];
|
|
111
|
+
}
|
|
112
|
+
export interface MemoryHandlerProvider extends MemoryProvider {
|
|
113
|
+
getAtlas?(userId: string, options?: Record<string, unknown>): MemoryAtlasResult;
|
|
114
|
+
getActivitySummary?(userId: string, days: number): MemoryActivitySummary;
|
|
115
|
+
observeExtracted?(items: MemoryExtractionItem[], userId: string, options?: MemoryIngestOptions): Promise<MemoryConsolidationWriteResult>;
|
|
116
|
+
proposeExtracted?(items: MemoryExtractionItem[], userId: string, options?: MemoryIngestOptions): Promise<MemoryConsolidationWriteResult>;
|
|
117
|
+
ingestExtracted?(items: MemoryExtractionItem[], userId: string, options?: MemoryIngestOptions): Promise<MemoryConsolidationWriteResult>;
|
|
118
|
+
update?(id: string, patch: MemoryUpdatePatch): Promise<boolean>;
|
|
119
|
+
}
|
|
120
|
+
export interface MemoryDreamProvider {
|
|
121
|
+
search(query: string, userId: string, options?: {
|
|
122
|
+
limit?: number;
|
|
123
|
+
}): Promise<MemorySearchResult[]>;
|
|
124
|
+
proposeExtracted?(items: MemoryExtractionItem[], userId: string, options?: {
|
|
125
|
+
sessionId?: string;
|
|
126
|
+
source?: string;
|
|
127
|
+
}): Promise<{
|
|
128
|
+
proposalsAdded?: number;
|
|
129
|
+
}>;
|
|
130
|
+
feedback?(memoryIds: string[], signal: "useful" | "irrelevant" | "outdated" | "wrong"): Promise<{
|
|
131
|
+
affected: number;
|
|
132
|
+
}>;
|
|
133
|
+
getActivitySummary?(userId: string, days?: number): MemoryActivitySummary;
|
|
134
|
+
synthesizeTimeline?(userId: string, startMs: number, endMs: number): string;
|
|
135
|
+
getProfile?(userId: string, key: string): string | null;
|
|
136
|
+
setProfile?(userId: string, key: string, value: string): void;
|
|
137
|
+
getAllProfiles?(userId: string): Record<string, string>;
|
|
138
|
+
}
|
|
139
|
+
export interface MemoryDecayProvider {
|
|
140
|
+
triggerDecay(userId: string, maxAgeDays?: number): Promise<{
|
|
141
|
+
decayed: number;
|
|
142
|
+
}>;
|
|
143
|
+
}
|
|
144
|
+
export type MemoryRuntimeHookProvider = MemoryProvider & MemoryWriter;
|
|
145
|
+
export type MemoryToolProvider = MemoryProvider & MemoryToolLocalProvider;
|
|
146
|
+
export type MemoryDreamRuntimeProvider = MemoryDreamProvider & MemoryDecayProvider;
|