@pellux/goodvibes-sdk 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contracts/artifacts/operator-contract.json +1320 -10
- package/dist/events/communication.d.ts +1 -1
- package/dist/platform/agents/orchestrator-runner.d.ts +5 -5
- package/dist/platform/agents/orchestrator-runner.js +6 -6
- package/dist/platform/agents/orchestrator.d.ts +4 -4
- package/dist/platform/agents/orchestrator.js +2 -2
- package/dist/platform/agents/wrfc-controller.d.ts +1 -1
- package/dist/platform/agents/wrfc-controller.js +3 -3
- package/dist/platform/calendar/index.d.ts +2 -2
- package/dist/platform/calendar/index.js +3 -3
- package/dist/platform/calendar/oauth-providers.d.ts +1 -1
- package/dist/platform/calendar/oauth-providers.js +1 -1
- package/dist/platform/calendar/oauth-types.d.ts +1 -1
- package/dist/platform/calendar/oauth-types.js +1 -1
- package/dist/platform/companion/companion-chat-branching.d.ts +66 -0
- package/dist/platform/companion/companion-chat-branching.d.ts.map +1 -0
- package/dist/platform/companion/companion-chat-branching.js +142 -0
- package/dist/platform/companion/companion-chat-broker-bridge.d.ts +1 -1
- package/dist/platform/companion/companion-chat-broker-bridge.d.ts.map +1 -1
- package/dist/platform/companion/companion-chat-broker-sync.d.ts +2 -2
- package/dist/platform/companion/companion-chat-broker-sync.d.ts.map +1 -1
- package/dist/platform/companion/companion-chat-broker-sync.js +1 -1
- package/dist/platform/companion/companion-chat-manager.d.ts +26 -5
- package/dist/platform/companion/companion-chat-manager.d.ts.map +1 -1
- package/dist/platform/companion/companion-chat-manager.js +67 -81
- package/dist/platform/companion/companion-chat-routes.d.ts.map +1 -1
- package/dist/platform/companion/companion-chat-routes.js +77 -1
- package/dist/platform/companion/companion-chat-turn-execution.d.ts +61 -0
- package/dist/platform/companion/companion-chat-turn-execution.d.ts.map +1 -0
- package/dist/platform/companion/companion-chat-turn-execution.js +107 -0
- package/dist/platform/companion/companion-chat-types.d.ts +67 -0
- package/dist/platform/companion/companion-chat-types.d.ts.map +1 -1
- package/dist/platform/config/credential-status.d.ts +1 -1
- package/dist/platform/config/credential-status.js +1 -1
- package/dist/platform/config/index.d.ts +1 -1
- package/dist/platform/config/index.js +1 -1
- package/dist/platform/config/manager.d.ts +1 -1
- package/dist/platform/config/manager.js +1 -1
- package/dist/platform/config/migrations.d.ts +2 -2
- package/dist/platform/config/migrations.js +2 -2
- package/dist/platform/config/schema-domain-runtime.d.ts +8 -0
- package/dist/platform/config/schema-domain-runtime.d.ts.map +1 -1
- package/dist/platform/config/schema-domain-runtime.js +32 -0
- package/dist/platform/config/schema-types.d.ts +10 -2
- package/dist/platform/config/schema-types.d.ts.map +1 -1
- package/dist/platform/control-plane/gateway-scope-enforcement.js +2 -2
- package/dist/platform/control-plane/index.d.ts +2 -0
- package/dist/platform/control-plane/index.d.ts.map +1 -1
- package/dist/platform/control-plane/index.js +5 -1
- package/dist/platform/control-plane/invoke-input-validation.d.ts +1 -1
- package/dist/platform/control-plane/invoke-input-validation.js +1 -1
- package/dist/platform/control-plane/method-catalog-calendar.d.ts +2 -2
- package/dist/platform/control-plane/method-catalog-calendar.js +2 -2
- package/dist/platform/control-plane/method-catalog-channels.js +3 -3
- package/dist/platform/control-plane/method-catalog-control-automation.js +4 -4
- package/dist/platform/control-plane/method-catalog-control-companion.d.ts +1 -1
- package/dist/platform/control-plane/method-catalog-control-companion.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-control-companion.js +43 -0
- package/dist/platform/control-plane/method-catalog-control-core.js +3 -3
- package/dist/platform/control-plane/method-catalog-email.d.ts +1 -1
- package/dist/platform/control-plane/method-catalog-email.js +1 -1
- package/dist/platform/control-plane/method-catalog-fleet.d.ts +1 -1
- package/dist/platform/control-plane/method-catalog-push.d.ts +30 -0
- package/dist/platform/control-plane/method-catalog-push.d.ts.map +1 -0
- package/dist/platform/control-plane/method-catalog-push.js +80 -0
- package/dist/platform/control-plane/method-catalog-route-reconcile.d.ts +1 -1
- package/dist/platform/control-plane/method-catalog-runtime.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog-runtime.js +83 -1
- package/dist/platform/control-plane/method-catalog.d.ts.map +1 -1
- package/dist/platform/control-plane/method-catalog.js +2 -0
- package/dist/platform/control-plane/operator-contract-schemas-fleet.js +1 -1
- package/dist/platform/control-plane/operator-contract-schemas-runtime.d.ts +8 -0
- package/dist/platform/control-plane/operator-contract-schemas-runtime.d.ts.map +1 -1
- package/dist/platform/control-plane/operator-contract-schemas-runtime.js +43 -0
- package/dist/platform/control-plane/routes/checkpoints.d.ts +1 -1
- package/dist/platform/control-plane/routes/fleet.d.ts +2 -2
- package/dist/platform/control-plane/routes/fleet.js +1 -1
- package/dist/platform/control-plane/routes/gateway-verb-error.d.ts +1 -1
- package/dist/platform/control-plane/routes/gateway-verb-error.js +1 -1
- package/dist/platform/control-plane/routes/index.js +1 -1
- package/dist/platform/control-plane/routes/invocation-params.d.ts +1 -1
- package/dist/platform/control-plane/routes/push.d.ts +26 -0
- package/dist/platform/control-plane/routes/push.d.ts.map +1 -0
- package/dist/platform/control-plane/routes/push.js +104 -0
- package/dist/platform/control-plane/routes/register-gateway-verb-groups.d.ts +31 -0
- package/dist/platform/control-plane/routes/register-gateway-verb-groups.d.ts.map +1 -0
- package/dist/platform/control-plane/routes/register-gateway-verb-groups.js +16 -0
- package/dist/platform/control-plane/routes/register-w3-s2.d.ts +2 -2
- package/dist/platform/control-plane/routes/session-search.d.ts +4 -4
- package/dist/platform/control-plane/session-broker.d.ts +1 -1
- package/dist/platform/control-plane/session-broker.js +1 -1
- package/dist/platform/control-plane/session-store-importer.d.ts +1 -1
- package/dist/platform/control-plane/session-store-importer.js +1 -1
- package/dist/platform/control-plane/session-types.d.ts +1 -1
- package/dist/platform/core/orchestrator-runtime.d.ts +4 -4
- package/dist/platform/core/orchestrator-tool-runtime.d.ts +1 -1
- package/dist/platform/core/orchestrator-turn-loop.d.ts +6 -6
- package/dist/platform/core/orchestrator-turn-loop.d.ts.map +1 -1
- package/dist/platform/core/orchestrator-turn-loop.js +23 -22
- package/dist/platform/core/orchestrator.d.ts +10 -10
- package/dist/platform/core/orchestrator.d.ts.map +1 -1
- package/dist/platform/core/orchestrator.js +8 -8
- package/dist/platform/daemon/boot.d.ts +6 -0
- package/dist/platform/daemon/boot.d.ts.map +1 -1
- package/dist/platform/daemon/boot.js +1 -0
- package/dist/platform/daemon/control-plane.js +2 -2
- package/dist/platform/daemon/facade.d.ts +4 -7
- package/dist/platform/daemon/facade.d.ts.map +1 -1
- package/dist/platform/daemon/facade.js +5 -7
- package/dist/platform/daemon/http/router-session-broker-adapter.d.ts +1 -1
- package/dist/platform/daemon/http/router.d.ts +1 -0
- package/dist/platform/daemon/http/router.d.ts.map +1 -1
- package/dist/platform/daemon/http/router.js +36 -19
- package/dist/platform/daemon/http/runtime-route-types.d.ts +1 -1
- package/dist/platform/daemon/http/runtime-route-types.d.ts.map +1 -1
- package/dist/platform/daemon/http/webui-serving.d.ts +68 -0
- package/dist/platform/daemon/http/webui-serving.d.ts.map +1 -0
- package/dist/platform/daemon/http/webui-serving.js +230 -0
- package/dist/platform/knowledge/knowledge-api.d.ts +1 -1
- package/dist/platform/orchestration/budget.d.ts +2 -2
- package/dist/platform/orchestration/cancellation.d.ts +2 -2
- package/dist/platform/orchestration/controller-compat.d.ts +2 -3
- package/dist/platform/orchestration/controller-compat.d.ts.map +1 -1
- package/dist/platform/orchestration/dirty-guard.js +1 -1
- package/dist/platform/orchestration/engine.d.ts.map +1 -1
- package/dist/platform/orchestration/engine.js +3 -4
- package/dist/platform/orchestration/persistence.js +2 -2
- package/dist/platform/orchestration/phase-runner.d.ts +4 -4
- package/dist/platform/orchestration/scheduler.d.ts +1 -1
- package/dist/platform/orchestration/types.d.ts +3 -3
- package/dist/platform/presentation/glyphs.d.ts +1 -1
- package/dist/platform/presentation/glyphs.js +1 -1
- package/dist/platform/presentation/index.d.ts +3 -3
- package/dist/platform/presentation/index.js +3 -3
- package/dist/platform/presentation/thinking-phrases.d.ts +1 -1
- package/dist/platform/presentation/thinking-phrases.js +1 -1
- package/dist/platform/presentation/waiting-wording.d.ts +1 -1
- package/dist/platform/presentation/waiting-wording.js +1 -1
- package/dist/platform/push/delivery.d.ts +48 -0
- package/dist/platform/push/delivery.d.ts.map +1 -0
- package/dist/platform/push/delivery.js +117 -0
- package/dist/platform/push/encryption.d.ts +41 -0
- package/dist/platform/push/encryption.d.ts.map +1 -0
- package/dist/platform/push/encryption.js +82 -0
- package/dist/platform/push/index.d.ts +17 -0
- package/dist/platform/push/index.d.ts.map +1 -0
- package/dist/platform/push/index.js +10 -0
- package/dist/platform/push/service.d.ts +75 -0
- package/dist/platform/push/service.d.ts.map +1 -0
- package/dist/platform/push/service.js +95 -0
- package/dist/platform/push/subscription-store.d.ts +50 -0
- package/dist/platform/push/subscription-store.d.ts.map +1 -0
- package/dist/platform/push/subscription-store.js +123 -0
- package/dist/platform/push/types.d.ts +68 -0
- package/dist/platform/push/types.d.ts.map +1 -0
- package/dist/platform/push/types.js +13 -0
- package/dist/platform/push/vapid.d.ts +54 -0
- package/dist/platform/push/vapid.d.ts.map +1 -0
- package/dist/platform/push/vapid.js +113 -0
- package/dist/platform/runtime/feature-flags/flags.js +3 -3
- package/dist/platform/runtime/fleet/adapters/agent.d.ts +2 -2
- package/dist/platform/runtime/fleet/adapters/agent.d.ts.map +1 -1
- package/dist/platform/runtime/fleet/adapters/agent.js +4 -4
- package/dist/platform/runtime/fleet/adapters/automation.d.ts +1 -1
- package/dist/platform/runtime/fleet/adapters/automation.js +1 -1
- package/dist/platform/runtime/fleet/adapters/code-index.d.ts +1 -1
- package/dist/platform/runtime/fleet/adapters/code-index.js +1 -1
- package/dist/platform/runtime/fleet/adapters/orchestration.js +1 -1
- package/dist/platform/runtime/fleet/adapters/schedule.d.ts +4 -4
- package/dist/platform/runtime/fleet/adapters/schedule.js +4 -4
- package/dist/platform/runtime/fleet/adapters/trigger.d.ts +3 -4
- package/dist/platform/runtime/fleet/adapters/trigger.d.ts.map +1 -1
- package/dist/platform/runtime/fleet/adapters/trigger.js +3 -4
- package/dist/platform/runtime/fleet/adapters/wrfc.js +1 -1
- package/dist/platform/runtime/fleet/registry.d.ts +7 -7
- package/dist/platform/runtime/fleet/registry.d.ts.map +1 -1
- package/dist/platform/runtime/fleet/registry.js +3 -3
- package/dist/platform/runtime/fleet/types.d.ts +9 -9
- package/dist/platform/runtime/fleet/types.d.ts.map +1 -1
- package/dist/platform/runtime/memory-spine/client.d.ts +127 -0
- package/dist/platform/runtime/memory-spine/client.d.ts.map +1 -0
- package/dist/platform/runtime/memory-spine/client.js +113 -0
- package/dist/platform/runtime/memory-spine/index.d.ts +11 -0
- package/dist/platform/runtime/memory-spine/index.d.ts.map +1 -0
- package/dist/platform/runtime/memory-spine/index.js +10 -0
- package/dist/platform/runtime/operator-client.d.ts +1 -1
- package/dist/platform/runtime/services.d.ts +6 -6
- package/dist/platform/runtime/services.d.ts.map +1 -1
- package/dist/platform/runtime/services.js +9 -9
- package/dist/platform/runtime/session-spine/union-cache.d.ts +1 -1
- package/dist/platform/runtime/session-spine/union-cache.js +1 -1
- package/dist/platform/state/canonical-memory.d.ts +7 -7
- package/dist/platform/state/canonical-memory.js +8 -8
- package/dist/platform/state/code-index-chunking.js +1 -1
- package/dist/platform/state/code-index-db.d.ts +1 -1
- package/dist/platform/state/code-index-store.js +1 -1
- package/dist/platform/state/index.d.ts +2 -2
- package/dist/platform/state/index.d.ts.map +1 -1
- package/dist/platform/state/index.js +1 -1
- package/dist/platform/state/memory-recall-contract.d.ts +59 -4
- package/dist/platform/state/memory-recall-contract.d.ts.map +1 -1
- package/dist/platform/state/memory-recall-contract.js +79 -3
- package/dist/platform/state/memory-registry.d.ts +8 -0
- package/dist/platform/state/memory-registry.d.ts.map +1 -1
- package/dist/platform/state/memory-registry.js +10 -0
- package/dist/platform/state/memory-vector-store.js +1 -1
- package/dist/platform/state/sqlite-vec-loader.d.ts +1 -1
- package/dist/platform/state/sqlite-vec-loader.js +1 -1
- package/dist/platform/state/vibe-projection.d.ts +3 -3
- package/dist/platform/state/vibe-projection.js +3 -3
- package/dist/platform/tools/agent/manager.d.ts +10 -10
- package/dist/platform/tools/agent/manager.js +7 -7
- package/dist/platform/tools/exec/runtime.js +5 -5
- package/dist/platform/tools/exec/schema.d.ts +1 -1
- package/dist/platform/tools/exec/schema.d.ts.map +1 -1
- package/dist/platform/tools/fetch/runtime.d.ts +1 -1
- package/dist/platform/tools/registry.d.ts +1 -1
- package/dist/platform/tools/registry.js +1 -1
- package/dist/platform/types/tools.d.ts +1 -1
- package/dist/platform/utils/request-body.d.ts.map +1 -1
- package/dist/platform/utils/request-body.js +50 -5
- package/dist/platform/version.js +1 -1
- package/package.json +13 -9
|
@@ -7,7 +7,7 @@ export function chainNodeId(chainId) {
|
|
|
7
7
|
export function subtaskNodeId(subtaskId) {
|
|
8
8
|
return `subtask:${subtaskId}`;
|
|
9
9
|
}
|
|
10
|
-
/** Work-item node ids are namespaced to avoid colliding with agent/process ids
|
|
10
|
+
/** Work-item node ids are namespaced to avoid colliding with agent/process ids. */
|
|
11
11
|
export function workItemNodeId(workItemId) {
|
|
12
12
|
return `work-item:${workItemId}`;
|
|
13
13
|
}
|
|
@@ -27,9 +27,9 @@ export function usageFromAgentRecord(record) {
|
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
* parentId precedence (brief-mandated,
|
|
30
|
+
* parentId precedence (brief-mandated, stable):
|
|
31
31
|
* wrfcSubtaskId → `subtask:<id>` else wrfcId → `chain:<id>` else
|
|
32
|
-
* workItemId → `work-item:<id>` (
|
|
32
|
+
* workItemId → `work-item:<id>` (orchestration-engine phase
|
|
33
33
|
* agents, a separate track from WRFC so the two systems' agents are never
|
|
34
34
|
* conflated) else orchestrationNodeId/parentNodeId (resolved to the owning
|
|
35
35
|
* agent) else parentAgentId. Every step falls through when the referenced
|
|
@@ -64,7 +64,7 @@ function deriveAgentState(record, entry, sessionId, ctx) {
|
|
|
64
64
|
return 'failed';
|
|
65
65
|
case 'cancelled':
|
|
66
66
|
// terminationKind distinguishes a graceful interrupt request from a hard
|
|
67
|
-
// kill for display purposes
|
|
67
|
+
// kill for display purposes. Records
|
|
68
68
|
// persisted before this field existed have no terminationKind and
|
|
69
69
|
// default to 'killed' — the historical behavior.
|
|
70
70
|
return record.terminationKind === 'interrupt' ? 'interrupted' : 'killed';
|
|
@@ -17,7 +17,7 @@ export interface AutomationJobRaw {
|
|
|
17
17
|
/** Type guard for AutomationJobRaw, used by registry.ts to distinguish an automation-job 'schedule' node's `raw` from a workflow-tool ScheduleEntry's `raw` — both share the 'schedule' kind. */
|
|
18
18
|
export declare function isAutomationJobRaw(raw: unknown): raw is AutomationJobRaw;
|
|
19
19
|
/**
|
|
20
|
-
* AutomationJob → ProcessNode
|
|
20
|
+
* AutomationJob → ProcessNode. Reuses the 'schedule'
|
|
21
21
|
* kind rather than inventing a new one — a job created via `/schedule` IS a
|
|
22
22
|
* schedule from the user's viewpoint, even though it lives in a completely
|
|
23
23
|
* separate subsystem (platform/automation) from the workflow-tool's
|
|
@@ -14,7 +14,7 @@ export function isAutomationJobRaw(raw) {
|
|
|
14
14
|
return raw !== null && typeof raw === 'object' && raw.source === 'automation-manager';
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* AutomationJob → ProcessNode
|
|
17
|
+
* AutomationJob → ProcessNode. Reuses the 'schedule'
|
|
18
18
|
* kind rather than inventing a new one — a job created via `/schedule` IS a
|
|
19
19
|
* schedule from the user's viewpoint, even though it lives in a completely
|
|
20
20
|
* separate subsystem (platform/automation) from the workflow-tool's
|
|
@@ -15,7 +15,7 @@ export declare function codeIndexNodeId(): string;
|
|
|
15
15
|
* background-process): liveness rides the registry tick. An index build has
|
|
16
16
|
* no pid, so it is NOT a 'background-process' node (ProcessManager is
|
|
17
17
|
* shell/OS-process-only) — it gets its own ProcessKind, mirroring the
|
|
18
|
-
*
|
|
18
|
+
* orchestrationEngine-dep precedent.
|
|
19
19
|
*/
|
|
20
20
|
export declare function adaptCodeIndex(service: CodeIndexProcessSource, now: number): ProcessNode;
|
|
21
21
|
//# sourceMappingURL=code-index.d.ts.map
|
|
@@ -8,7 +8,7 @@ export function codeIndexNodeId() {
|
|
|
8
8
|
* background-process): liveness rides the registry tick. An index build has
|
|
9
9
|
* no pid, so it is NOT a 'background-process' node (ProcessManager is
|
|
10
10
|
* shell/OS-process-only) — it gets its own ProcessKind, mirroring the
|
|
11
|
-
*
|
|
11
|
+
* orchestrationEngine-dep precedent.
|
|
12
12
|
*/
|
|
13
13
|
export function adaptCodeIndex(service, now) {
|
|
14
14
|
const building = service.isBuilding();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** SDK-owned platform module. This implementation is maintained in goodvibes-sdk. */
|
|
2
2
|
/**
|
|
3
|
-
* Orchestration-engine fleet adapters
|
|
3
|
+
* Orchestration-engine fleet adapters — Workstream/Phase/
|
|
4
4
|
* WorkItem -> ProcessNode, mirroring adapters/wrfc.ts's chain/subtask
|
|
5
5
|
* pattern: a workstream is a root node (no native cancel of its own, so kill
|
|
6
6
|
* is DERIVED — cascades AgentManager.cancel over every agent any item ever
|
|
@@ -5,10 +5,10 @@ import type { ProcessNode } from '../types.js';
|
|
|
5
5
|
export declare function scheduleNodeId(name: string): string;
|
|
6
6
|
/**
|
|
7
7
|
* ScheduleEntry → ProcessNode. A schedule between runs is honestly 'idle'
|
|
8
|
-
* (not force-fit into an active state); disabled maps to 'paused' (
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* (not force-fit into an active state); disabled maps to 'paused' (NOT
|
|
9
|
+
* 'killed': the entry still exists and ScheduleManager.enable() can re-arm
|
|
10
|
+
* it, so collapsing it into a terminal state was dishonest). resumable
|
|
11
|
+
* mirrors the inverse of pausable.
|
|
12
12
|
*/
|
|
13
13
|
export declare function adaptSchedule(entry: ScheduleEntry): ProcessNode;
|
|
14
14
|
//# sourceMappingURL=schedule.d.ts.map
|
|
@@ -5,10 +5,10 @@ export function scheduleNodeId(name) {
|
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* ScheduleEntry → ProcessNode. A schedule between runs is honestly 'idle'
|
|
8
|
-
* (not force-fit into an active state); disabled maps to 'paused' (
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* (not force-fit into an active state); disabled maps to 'paused' (NOT
|
|
9
|
+
* 'killed': the entry still exists and ScheduleManager.enable() can re-arm
|
|
10
|
+
* it, so collapsing it into a terminal state was dishonest). resumable
|
|
11
|
+
* mirrors the inverse of pausable.
|
|
12
12
|
*/
|
|
13
13
|
export function adaptSchedule(entry) {
|
|
14
14
|
return {
|
|
@@ -3,10 +3,9 @@ import type { TriggerDefinition } from '../../../tools/workflow/index.js';
|
|
|
3
3
|
import type { ProcessNode } from '../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* TriggerDefinition → ProcessNode. Triggers have no timestamps and no run
|
|
6
|
-
* state — enabled means armed ('idle'), disabled maps to 'paused' (
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* pausable.
|
|
6
|
+
* state — enabled means armed ('idle'), disabled maps to 'paused' (NOT
|
|
7
|
+
* 'killed': the definition still exists and TriggerManager.enable() can
|
|
8
|
+
* re-arm it). resumable mirrors the inverse of pausable.
|
|
10
9
|
*/
|
|
11
10
|
export declare function adaptTrigger(def: TriggerDefinition): ProcessNode;
|
|
12
11
|
//# sourceMappingURL=trigger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger.d.ts","sourceRoot":"","sources":["../../../../../src/platform/runtime/fleet/adapters/trigger.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C
|
|
1
|
+
{"version":3,"file":"trigger.d.ts","sourceRoot":"","sources":["../../../../../src/platform/runtime/fleet/adapters/trigger.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,iBAAiB,GAAG,WAAW,CAahE"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/** SDK-owned platform module. This implementation is maintained in goodvibes-sdk. */
|
|
2
2
|
/**
|
|
3
3
|
* TriggerDefinition → ProcessNode. Triggers have no timestamps and no run
|
|
4
|
-
* state — enabled means armed ('idle'), disabled maps to 'paused' (
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* pausable.
|
|
4
|
+
* state — enabled means armed ('idle'), disabled maps to 'paused' (NOT
|
|
5
|
+
* 'killed': the definition still exists and TriggerManager.enable() can
|
|
6
|
+
* re-arm it). resumable mirrors the inverse of pausable.
|
|
8
7
|
*/
|
|
9
8
|
export function adaptTrigger(def) {
|
|
10
9
|
return {
|
|
@@ -135,7 +135,7 @@ function sumUsage(nodes) {
|
|
|
135
135
|
*
|
|
136
136
|
* The owner agent is EXCLUDED from aggregation: it runs no LLM turns itself —
|
|
137
137
|
* its AgentRecord.usage is populated FROM the phase children at completion
|
|
138
|
-
* time
|
|
138
|
+
* time, so including it would double-count.
|
|
139
139
|
*/
|
|
140
140
|
function aggregateCost(members) {
|
|
141
141
|
const withUsage = members.filter((node) => node.usage !== undefined);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** SDK-owned platform module. This implementation is maintained in goodvibes-sdk. */
|
|
2
2
|
/**
|
|
3
|
-
* Live process registry
|
|
3
|
+
* Live process registry — one queryable + subscribable aggregation
|
|
4
4
|
* surface over the already-composed runtime managers. ZERO new store state:
|
|
5
5
|
* every query is an aggregate-on-read over the managers' in-memory maps, and
|
|
6
6
|
* the only registry-owned mutable state is the agent activity side-table fed
|
|
@@ -49,7 +49,7 @@ export interface ProcessRegistryDeps {
|
|
|
49
49
|
readonly agentManager: Pick<AgentManager, 'list' | 'cancel'>;
|
|
50
50
|
readonly wrfcController: Pick<WrfcController, 'listChains'>;
|
|
51
51
|
/**
|
|
52
|
-
* Optional
|
|
52
|
+
* Optional: folds workstream/phase/work-item nodes into
|
|
53
53
|
* the fleet, nested workstream -> phase -> work-item, mirroring the
|
|
54
54
|
* wrfc-chain/subtask nesting. Without this dep the registry degrades to
|
|
55
55
|
* exactly today's behavior — no orchestration nodes, no new capability.
|
|
@@ -67,23 +67,23 @@ export interface ProcessRegistryDeps {
|
|
|
67
67
|
readonly watcherRegistry: Pick<WatcherRegistry, 'list' | 'stopWatcher'>;
|
|
68
68
|
readonly workflow: {
|
|
69
69
|
readonly workflowManager: Pick<WorkflowManager, 'list' | 'cancel'>;
|
|
70
|
-
/** `enable`
|
|
70
|
+
/** `enable` backs ProcessRegistry.resume() — the inverse of `disable`'s interrupt/pause. */
|
|
71
71
|
readonly triggerManager: Pick<TriggerManager, 'list' | 'remove' | 'disable' | 'enable'>;
|
|
72
72
|
readonly scheduleManager: Pick<ScheduleManager, 'list' | 'remove' | 'disable' | 'enable'>;
|
|
73
73
|
};
|
|
74
74
|
/** Optional: awaiting-approval derivation. Non-control-plane runtimes still build a fleet. */
|
|
75
75
|
readonly approvalBroker?: Pick<ApprovalBroker, 'listApprovals'> | undefined;
|
|
76
|
-
/** Optional: populates ProcessNode.sessionRef.sessionId (
|
|
76
|
+
/** Optional: populates ProcessNode.sessionRef.sessionId (tab attach point). */
|
|
77
77
|
readonly sessionBroker?: Pick<SharedSessionBroker, 'listSessions'> | undefined;
|
|
78
78
|
/**
|
|
79
|
-
* Optional: the repo source-tree code index (
|
|
79
|
+
* Optional: the repo source-tree code index (Stage A).
|
|
80
80
|
* When present, its build/idle state surfaces as a single 'code-index'
|
|
81
81
|
* ProcessNode. Without this dep the fleet degrades to exactly today's
|
|
82
82
|
* behavior — zero code-index nodes, no new capability.
|
|
83
83
|
*/
|
|
84
84
|
readonly codeIndexService?: CodeIndexProcessSource | undefined;
|
|
85
85
|
/**
|
|
86
|
-
* Optional
|
|
86
|
+
* Optional: folds `/schedule` automation jobs
|
|
87
87
|
* (platform/automation, a SEPARATE subsystem from the workflow-tool's
|
|
88
88
|
* ScheduleManager above) into the fleet as 'schedule'-kind nodes — see
|
|
89
89
|
* adapters/automation.ts. Without this dep the fleet degrades to exactly
|
|
@@ -91,7 +91,7 @@ export interface ProcessRegistryDeps {
|
|
|
91
91
|
*/
|
|
92
92
|
readonly automationManager?: Pick<AutomationManager, 'listJobs' | 'setEnabled' | 'removeJob'> | undefined;
|
|
93
93
|
/**
|
|
94
|
-
* Optional: backs `steer()` and the `steerable` capability
|
|
94
|
+
* Optional: backs `steer()` and the `steerable` capability. The
|
|
95
95
|
* bus already exists in the composed runtime and already feeds every
|
|
96
96
|
* in-process agent's per-turn inbox drain (orchestrator-runner.ts) — this
|
|
97
97
|
* just hands the registry a narrow `send`-only pick of it. Without this
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/platform/runtime/fleet/registry.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAe,MAAM,8BAA8B,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAEV,eAAe,EACf,cAAc,EACd,eAAe,EAChB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EA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CAAC,EAAE,IAAI,CAAC,mBAAmB,EAAE,cAAc,CAAC,GAAG,SAAS,CAAC;IAC/E;;;;;OAKG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,sBAAsB,GAAG,SAAS,CAAC;IAC/D;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,YAAY,GAAG,WAAW,CAAC,GAAG,SAAS,CAAC;IAC1G;;;;;;;OAOG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IAChE,qHAAqH;IACrH,QAAQ,CAAC,UAAU,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;IAClD,8FAA8F;IAC9F,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,YAAY,KAAK,MAAM,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IACtG,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,MAAM,CAAC,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7C,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;CAC9C;AAkDD,2EAA2E;AAC3E,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,mBAAmB,GAAG,eAAe,CA0lBhF"}
|
|
@@ -387,8 +387,8 @@ export function createProcessRegistry(deps) {
|
|
|
387
387
|
return affected;
|
|
388
388
|
}
|
|
389
389
|
/**
|
|
390
|
-
* Fire-and-forget an AutomationManager async control call
|
|
391
|
-
*
|
|
390
|
+
* Fire-and-forget an AutomationManager async control call: the
|
|
391
|
+
* registry's own kill/interrupt/resume verbs are
|
|
392
392
|
* synchronous, but AutomationManager.removeJob/setEnabled are Promises —
|
|
393
393
|
* dispatch without awaiting rather than making every registry verb async,
|
|
394
394
|
* but never let a rejection vanish silently. The next tick's assemble()
|
|
@@ -545,7 +545,7 @@ export function createProcessRegistry(deps) {
|
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
547
|
/**
|
|
548
|
-
*
|
|
548
|
+
* Re-arm a `paused` trigger/schedule via the owning
|
|
549
549
|
* manager's `enable()` — the inverse of interrupt()'s disable. Re-assemble
|
|
550
550
|
* + dispatch-by-kind mirrors interrupt()/kill()'s own shape exactly (same
|
|
551
551
|
* synchronous, no-owned-state pattern as every other control verb here).
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/** SDK-owned platform module. This implementation is maintained in goodvibes-sdk. */
|
|
2
2
|
/**
|
|
3
3
|
* Fleet types — the normalized process-tree contract for the live process
|
|
4
|
-
* registry
|
|
4
|
+
* registry. One queryable + subscribable aggregation surface that
|
|
5
5
|
* enumerates every live/completed runtime process (agents incl. WRFC roles,
|
|
6
6
|
* WRFC chains + subtasks, workflow-tool FSMs/triggers/schedules, watchers,
|
|
7
7
|
* background processes) as flat `ProcessNode` records with parentId edges.
|
|
8
8
|
*
|
|
9
|
-
* Consumers (the TUI fleet tree,
|
|
9
|
+
* Consumers (the TUI fleet tree, session tabs, orchestration
|
|
10
10
|
* nesting) build the tree from the flat list — this keeps the registry cheap
|
|
11
11
|
* and lets each surface reorder/filter independently.
|
|
12
12
|
*/
|
|
@@ -19,17 +19,17 @@ export type ProcessKind = 'agent' | 'wrfc-chain' | 'wrfc-subtask' | 'workflow' |
|
|
|
19
19
|
* ScheduleEntry-between-runs and pending agents need honest states rather
|
|
20
20
|
* than being force-fit into an active state.
|
|
21
21
|
*
|
|
22
|
-
* `interrupted`
|
|
22
|
+
* `interrupted` is a distinct TERMINAL outcome
|
|
23
23
|
* from `killed`: both come from AgentManager.cancel(), but a graceful
|
|
24
24
|
* interrupt request and a hard kill are display-distinguishable via
|
|
25
25
|
* AgentRecord.terminationKind. There is no resume path — `cancel()` is
|
|
26
26
|
* terminal in the current SDK, so 'interrupted' does NOT mean "process still
|
|
27
27
|
* alive"; it means "the operator asked nicely" vs. "the operator killed it".
|
|
28
28
|
*
|
|
29
|
-
* `paused`
|
|
29
|
+
* `paused` is NOT terminal and NOT the same as
|
|
30
30
|
* `killed`: a disabled trigger/schedule/automation-job still exists and can
|
|
31
31
|
* be re-armed via `ProcessRegistry.resume()` — collapsing it into `killed`
|
|
32
|
-
* (the
|
|
32
|
+
* (the previous behavior) was dishonest, since `killed` implies the
|
|
33
33
|
* process is gone for good. See ProcessCapabilities.resumable.
|
|
34
34
|
*/
|
|
35
35
|
export type ProcessState = 'thinking' | 'executing-tool' | 'awaiting-approval' | 'streaming' | 'stalled' | 'retrying' | 'done' | 'failed' | 'killed' | 'interrupted' | 'idle' | 'queued' | 'paused';
|
|
@@ -58,7 +58,7 @@ export interface ProcessCapabilities {
|
|
|
58
58
|
readonly killable: boolean;
|
|
59
59
|
readonly pausable: boolean;
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
61
|
+
* Whether `ProcessRegistry.resume()` can re-arm
|
|
62
62
|
* this node. True only for a node currently in the `paused` state whose
|
|
63
63
|
* source manager exposes an `enable` control (trigger, schedule,
|
|
64
64
|
* automation job) — false for every other kind/state, including a
|
|
@@ -66,7 +66,7 @@ export interface ProcessCapabilities {
|
|
|
66
66
|
*/
|
|
67
67
|
readonly resumable: boolean;
|
|
68
68
|
/**
|
|
69
|
-
*
|
|
69
|
+
* Whether `ProcessRegistry.steer()` can queue a message for this
|
|
70
70
|
* node. True only for a live in-process agent (or a wrfc-subtask with a
|
|
71
71
|
* live member agent) AND only when the registry was constructed with a
|
|
72
72
|
* `messageBus` dep — false everywhere when that dep is absent (graceful
|
|
@@ -76,7 +76,7 @@ export interface ProcessCapabilities {
|
|
|
76
76
|
*/
|
|
77
77
|
readonly steerable: boolean;
|
|
78
78
|
}
|
|
79
|
-
/**
|
|
79
|
+
/** Tab attach point: session/agent identity for transcript drill-downs. */
|
|
80
80
|
export interface ProcessSessionRef {
|
|
81
81
|
readonly sessionId?: string | undefined;
|
|
82
82
|
readonly agentId?: string | undefined;
|
|
@@ -167,7 +167,7 @@ export interface ProcessRegistry {
|
|
|
167
167
|
*/
|
|
168
168
|
interrupt(id: string): boolean;
|
|
169
169
|
/**
|
|
170
|
-
*
|
|
170
|
+
* Re-arm a `paused` node — triggers/schedules via
|
|
171
171
|
* their manager's `enable()`, the inverse of `interrupt()`'s disable.
|
|
172
172
|
* Honest refusal (returns false, no throw) for a node that is not
|
|
173
173
|
* resumable: not found, not currently `paused`, or a kind whose source
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/platform/runtime/fleet/types.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF;;;;;;;;;;GAUG;AAEH,wDAAwD;AACxD,MAAM,MAAM,WAAW,GACnB,OAAO,GACP,YAAY,GACZ,cAAc,GACd,UAAU,GACV,SAAS,GACT,UAAU,GACV,SAAS,GACT,oBAAoB,GAGpB,YAAY,GACZ,OAAO,GACP,WAAW,GAKX,YAAY,CAAC;AAEjB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,YAAY,GACpB,UAAU,GACV,gBAAgB,GAChB,mBAAmB,GACnB,WAAW,GACX,SAAS,GACT,UAAU,GACV,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,aAAa,GACb,MAAM,GACN,QAAQ,GACR,QAAQ,CAAC;AAEb,0FAA0F;AAC1F,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM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E,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC7C,8EAA8E;IAC9E,OAAO,IAAI,IAAI,CAAC;CACjB"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* client.ts — the SDK memory-spine surface client (host-vs-client access mode).
|
|
3
|
+
*
|
|
4
|
+
* The daemon-owned memory service makes the daemon the SINGLE WRITER of its
|
|
5
|
+
* canonical sql.js store. sql.js has no row locking and rewrites the whole file on
|
|
6
|
+
* every save(), so two live processes writing the same file clobber each other —
|
|
7
|
+
* a whole-file lost update that would DELETE memory. One process must own the
|
|
8
|
+
* store; every other surface reaches it over the wire.
|
|
9
|
+
*
|
|
10
|
+
* This client is the surface-side switch that realizes that invariant, mirroring
|
|
11
|
+
* the session-spine host-vs-client pattern:
|
|
12
|
+
*
|
|
13
|
+
* - HOST / OFFLINE-EMBEDDED mode (transport NOT attached): the surface IS the only
|
|
14
|
+
* process touching its own store file, so it reads/writes the LOCAL embedded
|
|
15
|
+
* store directly. This is the offline fallback the agent and TUI keep — a daemon
|
|
16
|
+
* is not required for them to work.
|
|
17
|
+
* - CLIENT-OF-ADOPTED-DAEMON mode (transport attached): the daemon owns the store;
|
|
18
|
+
* the surface routes EVERY memory op through the injected wire transport and
|
|
19
|
+
* NEVER opens the file. Enforced structurally here — the active branch only ever
|
|
20
|
+
* touches `this.transport`, never `this.local`.
|
|
21
|
+
*
|
|
22
|
+
* ONE-WRITER ENFORCEMENT RULING. The platform's convention (see canonical-memory.ts
|
|
23
|
+
* and the session spine) is honest sequential/owned access plus stated posture, NOT
|
|
24
|
+
* an OS advisory lock — sql.js exposes no lock and a cross-process flock would be a
|
|
25
|
+
* new, unenforceable-on-every-OS mechanism the rest of the store does not rely on.
|
|
26
|
+
* So the invariant is enforced two ways, both honest: (1) mode exclusivity — a
|
|
27
|
+
* client in wire mode provably cannot reach the local file because the code routes
|
|
28
|
+
* exclusively to the transport; (2) a documented single-writer contract for the
|
|
29
|
+
* embedded case — the daemon host and an offline surface are each the sole process
|
|
30
|
+
* for their own file. `mode()` reports the current posture so a surface can surface
|
|
31
|
+
* it rather than guess.
|
|
32
|
+
*
|
|
33
|
+
* HONEST FAILURE. Unlike the fire-and-forget session mirror, memory reads/writes
|
|
34
|
+
* return data, so this client is request/response. In client mode a transport
|
|
35
|
+
* failure is SURFACED to the caller (the promise rejects); it is deliberately NOT
|
|
36
|
+
* silently served from the local store — a wire client must not open the
|
|
37
|
+
* daemon-owned file, and returning a divergent local copy as if it were canonical
|
|
38
|
+
* would be the exact dishonest-recall failure this whole design exists to prevent.
|
|
39
|
+
* A sustained daemon loss is handled by `deactivate()`, which returns the surface
|
|
40
|
+
* to owned-local mode explicitly.
|
|
41
|
+
*/
|
|
42
|
+
import { logger } from '../../utils/logger.js';
|
|
43
|
+
import type { MemoryAddOptions, MemoryRecord, MemoryReviewPatch, MemorySearchFilter } from '../../state/memory-store.js';
|
|
44
|
+
import type { HonestMemorySearchOptions, HonestMemorySearchResult } from '../../state/memory-recall-contract.js';
|
|
45
|
+
/**
|
|
46
|
+
* The memory read/write surface a caller uses without caring whether it resolves
|
|
47
|
+
* locally or over the wire. Every method is async so a local (sync store) and a
|
|
48
|
+
* wire (async) backend present the SAME shape.
|
|
49
|
+
*/
|
|
50
|
+
export interface MemoryAccess {
|
|
51
|
+
add(opts: MemoryAddOptions): Promise<MemoryRecord>;
|
|
52
|
+
honestSearch(filter: MemorySearchFilter, options?: HonestMemorySearchOptions): Promise<HonestMemorySearchResult>;
|
|
53
|
+
get(id: string): Promise<MemoryRecord | null>;
|
|
54
|
+
updateReview(id: string, patch: MemoryReviewPatch): Promise<MemoryRecord | null>;
|
|
55
|
+
delete(id: string): Promise<boolean>;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The injected wire transport. A consumer builds a thin adapter over the daemon's
|
|
59
|
+
* memory.records.* routes (POST /api/memory/records, /search, GET/DELETE
|
|
60
|
+
* /api/memory/records/:id, POST /api/memory/records/:id/review). The core only ever
|
|
61
|
+
* calls these methods — it never assumes a typed client exists, so a surface pinned
|
|
62
|
+
* to an older SDK can still adapt raw REST, exactly like the session spine.
|
|
63
|
+
*/
|
|
64
|
+
export type MemoryTransport = MemoryAccess;
|
|
65
|
+
/**
|
|
66
|
+
* The local embedded store surface. The SDK's `MemoryRegistry` satisfies this
|
|
67
|
+
* structurally (its methods are mostly synchronous; the facade normalizes them to
|
|
68
|
+
* promises). Kept minimal so the client stays decoupled from the concrete class.
|
|
69
|
+
*/
|
|
70
|
+
export interface LocalMemoryStore {
|
|
71
|
+
add(opts: MemoryAddOptions): Promise<MemoryRecord> | MemoryRecord;
|
|
72
|
+
honestSearch(filter: MemorySearchFilter, options?: HonestMemorySearchOptions): HonestMemorySearchResult;
|
|
73
|
+
get(id: string): MemoryRecord | null;
|
|
74
|
+
review(id: string, patch: MemoryReviewPatch): MemoryRecord | null;
|
|
75
|
+
delete(id: string): boolean;
|
|
76
|
+
}
|
|
77
|
+
/** Wrap a local embedded store (e.g. a MemoryRegistry) as a MemoryAccess. */
|
|
78
|
+
export declare function createLocalMemoryAccess(store: LocalMemoryStore): MemoryAccess;
|
|
79
|
+
/** Current access posture — honest, reportable, never guessed. */
|
|
80
|
+
export type MemoryAccessMode = 'local' | 'client';
|
|
81
|
+
type SpineLogger = Pick<typeof logger, 'debug' | 'info'>;
|
|
82
|
+
export interface MemorySpineClientOptions {
|
|
83
|
+
/** The local embedded store, always present as the offline/host backend. */
|
|
84
|
+
readonly local: MemoryAccess;
|
|
85
|
+
/**
|
|
86
|
+
* Attach a wire transport at construction for CLIENT mode immediately (a surface
|
|
87
|
+
* that boots already adopted to a daemon). Omit for LOCAL mode until `activate()`
|
|
88
|
+
* (a surface that adopts a daemon later, or runs offline forever).
|
|
89
|
+
*/
|
|
90
|
+
readonly transport?: MemoryTransport | undefined;
|
|
91
|
+
readonly log?: SpineLogger;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Routes memory access to the LOCAL embedded store or, when a daemon has been
|
|
95
|
+
* adopted, THROUGH the wire — never both. Implements {@link MemoryAccess} so a
|
|
96
|
+
* caller uses one object regardless of mode.
|
|
97
|
+
*/
|
|
98
|
+
export declare class MemorySpineClient implements MemoryAccess {
|
|
99
|
+
private readonly local;
|
|
100
|
+
private transport;
|
|
101
|
+
private readonly log;
|
|
102
|
+
constructor(options: MemorySpineClientOptions);
|
|
103
|
+
/** The current posture: 'client' when routing over the wire, 'local' otherwise. */
|
|
104
|
+
mode(): MemoryAccessMode;
|
|
105
|
+
/** Whether a wire transport is attached (client-of-adopted-daemon mode). */
|
|
106
|
+
get active(): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Adopt a daemon: route every memory op through the wire from now on. The local
|
|
109
|
+
* store is left untouched for the lifetime of client mode — the daemon is the
|
|
110
|
+
* single writer.
|
|
111
|
+
*/
|
|
112
|
+
activate(transport: MemoryTransport): void;
|
|
113
|
+
/** Release the daemon (mode lost / daemon stopped): return to owned-local access. */
|
|
114
|
+
deactivate(reason: string): void;
|
|
115
|
+
add(opts: MemoryAddOptions): Promise<MemoryRecord>;
|
|
116
|
+
honestSearch(filter: MemorySearchFilter, options?: HonestMemorySearchOptions): Promise<HonestMemorySearchResult>;
|
|
117
|
+
get(id: string): Promise<MemoryRecord | null>;
|
|
118
|
+
updateReview(id: string, patch: MemoryReviewPatch): Promise<MemoryRecord | null>;
|
|
119
|
+
delete(id: string): Promise<boolean>;
|
|
120
|
+
/**
|
|
121
|
+
* The single choke point that realizes the one-writer invariant: in client mode
|
|
122
|
+
* EVERY op resolves through the transport and the local store is never reached.
|
|
123
|
+
*/
|
|
124
|
+
private route;
|
|
125
|
+
}
|
|
126
|
+
export {};
|
|
127
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/platform/runtime/memory-spine/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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AAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAIhF,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIpC;;;OAGG;IACH,OAAO,CAAC,KAAK;CAGd"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* client.ts — the SDK memory-spine surface client (host-vs-client access mode).
|
|
3
|
+
*
|
|
4
|
+
* The daemon-owned memory service makes the daemon the SINGLE WRITER of its
|
|
5
|
+
* canonical sql.js store. sql.js has no row locking and rewrites the whole file on
|
|
6
|
+
* every save(), so two live processes writing the same file clobber each other —
|
|
7
|
+
* a whole-file lost update that would DELETE memory. One process must own the
|
|
8
|
+
* store; every other surface reaches it over the wire.
|
|
9
|
+
*
|
|
10
|
+
* This client is the surface-side switch that realizes that invariant, mirroring
|
|
11
|
+
* the session-spine host-vs-client pattern:
|
|
12
|
+
*
|
|
13
|
+
* - HOST / OFFLINE-EMBEDDED mode (transport NOT attached): the surface IS the only
|
|
14
|
+
* process touching its own store file, so it reads/writes the LOCAL embedded
|
|
15
|
+
* store directly. This is the offline fallback the agent and TUI keep — a daemon
|
|
16
|
+
* is not required for them to work.
|
|
17
|
+
* - CLIENT-OF-ADOPTED-DAEMON mode (transport attached): the daemon owns the store;
|
|
18
|
+
* the surface routes EVERY memory op through the injected wire transport and
|
|
19
|
+
* NEVER opens the file. Enforced structurally here — the active branch only ever
|
|
20
|
+
* touches `this.transport`, never `this.local`.
|
|
21
|
+
*
|
|
22
|
+
* ONE-WRITER ENFORCEMENT RULING. The platform's convention (see canonical-memory.ts
|
|
23
|
+
* and the session spine) is honest sequential/owned access plus stated posture, NOT
|
|
24
|
+
* an OS advisory lock — sql.js exposes no lock and a cross-process flock would be a
|
|
25
|
+
* new, unenforceable-on-every-OS mechanism the rest of the store does not rely on.
|
|
26
|
+
* So the invariant is enforced two ways, both honest: (1) mode exclusivity — a
|
|
27
|
+
* client in wire mode provably cannot reach the local file because the code routes
|
|
28
|
+
* exclusively to the transport; (2) a documented single-writer contract for the
|
|
29
|
+
* embedded case — the daemon host and an offline surface are each the sole process
|
|
30
|
+
* for their own file. `mode()` reports the current posture so a surface can surface
|
|
31
|
+
* it rather than guess.
|
|
32
|
+
*
|
|
33
|
+
* HONEST FAILURE. Unlike the fire-and-forget session mirror, memory reads/writes
|
|
34
|
+
* return data, so this client is request/response. In client mode a transport
|
|
35
|
+
* failure is SURFACED to the caller (the promise rejects); it is deliberately NOT
|
|
36
|
+
* silently served from the local store — a wire client must not open the
|
|
37
|
+
* daemon-owned file, and returning a divergent local copy as if it were canonical
|
|
38
|
+
* would be the exact dishonest-recall failure this whole design exists to prevent.
|
|
39
|
+
* A sustained daemon loss is handled by `deactivate()`, which returns the surface
|
|
40
|
+
* to owned-local mode explicitly.
|
|
41
|
+
*/
|
|
42
|
+
import { logger } from '../../utils/logger.js';
|
|
43
|
+
/** Wrap a local embedded store (e.g. a MemoryRegistry) as a MemoryAccess. */
|
|
44
|
+
export function createLocalMemoryAccess(store) {
|
|
45
|
+
return {
|
|
46
|
+
add: (opts) => Promise.resolve(store.add(opts)),
|
|
47
|
+
honestSearch: (filter, options) => Promise.resolve(store.honestSearch(filter, options)),
|
|
48
|
+
get: (id) => Promise.resolve(store.get(id)),
|
|
49
|
+
updateReview: (id, patch) => Promise.resolve(store.review(id, patch)),
|
|
50
|
+
delete: (id) => Promise.resolve(store.delete(id)),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Routes memory access to the LOCAL embedded store or, when a daemon has been
|
|
55
|
+
* adopted, THROUGH the wire — never both. Implements {@link MemoryAccess} so a
|
|
56
|
+
* caller uses one object regardless of mode.
|
|
57
|
+
*/
|
|
58
|
+
export class MemorySpineClient {
|
|
59
|
+
local;
|
|
60
|
+
transport;
|
|
61
|
+
log;
|
|
62
|
+
constructor(options) {
|
|
63
|
+
this.local = options.local;
|
|
64
|
+
this.transport = options.transport ?? null;
|
|
65
|
+
this.log = options.log ?? logger;
|
|
66
|
+
}
|
|
67
|
+
/** The current posture: 'client' when routing over the wire, 'local' otherwise. */
|
|
68
|
+
mode() {
|
|
69
|
+
return this.transport ? 'client' : 'local';
|
|
70
|
+
}
|
|
71
|
+
/** Whether a wire transport is attached (client-of-adopted-daemon mode). */
|
|
72
|
+
get active() {
|
|
73
|
+
return this.transport !== null;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Adopt a daemon: route every memory op through the wire from now on. The local
|
|
77
|
+
* store is left untouched for the lifetime of client mode — the daemon is the
|
|
78
|
+
* single writer.
|
|
79
|
+
*/
|
|
80
|
+
activate(transport) {
|
|
81
|
+
this.transport = transport;
|
|
82
|
+
this.log.info('memory spine activated — routing memory through the adopted external daemon (single writer)', {});
|
|
83
|
+
}
|
|
84
|
+
/** Release the daemon (mode lost / daemon stopped): return to owned-local access. */
|
|
85
|
+
deactivate(reason) {
|
|
86
|
+
if (this.transport === null)
|
|
87
|
+
return;
|
|
88
|
+
this.transport = null;
|
|
89
|
+
this.log.info('memory spine deactivated — reverting to owned-local memory access', { reason });
|
|
90
|
+
}
|
|
91
|
+
add(opts) {
|
|
92
|
+
return this.route().add(opts);
|
|
93
|
+
}
|
|
94
|
+
honestSearch(filter, options) {
|
|
95
|
+
return this.route().honestSearch(filter, options);
|
|
96
|
+
}
|
|
97
|
+
get(id) {
|
|
98
|
+
return this.route().get(id);
|
|
99
|
+
}
|
|
100
|
+
updateReview(id, patch) {
|
|
101
|
+
return this.route().updateReview(id, patch);
|
|
102
|
+
}
|
|
103
|
+
delete(id) {
|
|
104
|
+
return this.route().delete(id);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The single choke point that realizes the one-writer invariant: in client mode
|
|
108
|
+
* EVERY op resolves through the transport and the local store is never reached.
|
|
109
|
+
*/
|
|
110
|
+
route() {
|
|
111
|
+
return this.transport ?? this.local;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @pellux/goodvibes-sdk/platform/runtime/memory-spine
|
|
3
|
+
*
|
|
4
|
+
* The surface-side host-vs-client switch for the daemon-owned single-writer memory
|
|
5
|
+
* service. A daemon host (and any offline/embedded surface) uses the LOCAL store
|
|
6
|
+
* directly; a surface that has adopted a compatible daemon routes memory THROUGH
|
|
7
|
+
* the wire and never opens the store file. Mirrors the session-spine pattern; the
|
|
8
|
+
* offline fallback stays, so the agent and TUI keep working with no daemon running.
|
|
9
|
+
*/
|
|
10
|
+
export { MemorySpineClient, createLocalMemoryAccess, type MemoryAccess, type MemoryAccessMode, type MemoryTransport, type LocalMemoryStore, type MemorySpineClientOptions, } from './client.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/platform/runtime/memory-spine/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,GAC9B,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @pellux/goodvibes-sdk/platform/runtime/memory-spine
|
|
3
|
+
*
|
|
4
|
+
* The surface-side host-vs-client switch for the daemon-owned single-writer memory
|
|
5
|
+
* service. A daemon host (and any offline/embedded surface) uses the LOCAL store
|
|
6
|
+
* directly; a surface that has adopted a compatible daemon routes memory THROUGH
|
|
7
|
+
* the wire and never opens the store file. Mirrors the session-spine pattern; the
|
|
8
|
+
* offline fallback stays, so the agent and TUI keep working with no daemon running.
|
|
9
|
+
*/
|
|
10
|
+
export { MemorySpineClient, createLocalMemoryAccess, } from './client.js';
|
|
@@ -33,7 +33,7 @@ export interface OperatorSessionsClient {
|
|
|
33
33
|
/** Detach a surface's participant/route from a session without closing it
|
|
34
34
|
* (detach != close != kill). Idempotent; see sessions.detach. */
|
|
35
35
|
detach(sessionId: string, surfaceId: string): Promise<SharedSessionRecord | null>;
|
|
36
|
-
/** Permanently remove a session (
|
|
36
|
+
/** Permanently remove a session (delete != close). Requires the
|
|
37
37
|
* session already closed — see sessions.delete. */
|
|
38
38
|
delete(sessionId: string): Promise<'deleted' | 'not-found' | 'active'>;
|
|
39
39
|
bindAgent(sessionId: string, agentId: string): Promise<SharedSessionRecord | null>;
|