@skrr-ai/cli 0.1.22 → 0.1.23
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 +83 -73
- package/bin/dev-fallback.js +221 -0
- package/bin/run.js +43 -0
- package/dist/base-command.d.ts +15 -0
- package/dist/base-command.js +71 -10
- package/dist/commands/agents/attach-harness.d.ts +37 -0
- package/dist/commands/agents/attach-harness.js +102 -3
- package/dist/commands/agents/chat.d.ts +69 -1
- package/dist/commands/agents/chat.js +202 -22
- package/dist/commands/agents/create.d.ts +38 -0
- package/dist/commands/agents/create.js +95 -2
- package/dist/commands/agents/schedule-trace.js +11 -0
- package/dist/commands/agents/show.js +29 -1
- package/dist/commands/api-keys/create.d.ts +24 -0
- package/dist/commands/api-keys/create.js +80 -0
- package/dist/commands/api-keys/list.d.ts +11 -0
- package/dist/commands/api-keys/list.js +42 -0
- package/dist/commands/api-keys/revoke.d.ts +14 -0
- package/dist/commands/api-keys/revoke.js +33 -0
- package/dist/commands/api-keys/rotate.d.ts +19 -0
- package/dist/commands/api-keys/rotate.js +42 -0
- package/dist/commands/balance/index.d.ts +18 -0
- package/dist/commands/balance/index.js +29 -0
- package/dist/commands/balance/show.d.ts +25 -0
- package/dist/commands/balance/show.js +60 -0
- package/dist/commands/balance/statement.d.ts +19 -0
- package/dist/commands/balance/statement.js +52 -0
- package/dist/commands/browser/doctor.d.ts +11 -0
- package/dist/commands/browser/doctor.js +11 -0
- package/dist/commands/code/jobs/approve.d.ts +25 -0
- package/dist/commands/code/jobs/approve.js +52 -0
- package/dist/commands/code/jobs/cancel.d.ts +12 -0
- package/dist/commands/code/jobs/cancel.js +39 -0
- package/dist/commands/code/jobs/index.d.ts +19 -0
- package/dist/commands/code/jobs/index.js +38 -0
- package/dist/commands/code/jobs/list.d.ts +12 -0
- package/dist/commands/code/jobs/list.js +87 -0
- package/dist/commands/code/jobs/run.d.ts +32 -0
- package/dist/commands/code/jobs/run.js +151 -0
- package/dist/commands/code/jobs/show.d.ts +12 -0
- package/dist/commands/code/jobs/show.js +86 -0
- package/dist/commands/commitments/preflight.js +18 -4
- package/dist/commands/commitments/receipt-metrics.d.ts +39 -0
- package/dist/commands/commitments/receipt-metrics.js +78 -0
- package/dist/commands/convos/search.js +5 -5
- package/dist/commands/harnesses/leases/list.d.ts +3 -0
- package/dist/commands/harnesses/leases/list.js +59 -12
- package/dist/commands/harnesses/leases/show.js +36 -0
- package/dist/commands/harnesses/list.d.ts +18 -0
- package/dist/commands/harnesses/list.js +30 -0
- package/dist/commands/harnesses/products.js +48 -3
- package/dist/commands/harnesses/quota.d.ts +16 -0
- package/dist/commands/harnesses/quota.js +26 -1
- package/dist/commands/harnesses/usage.js +17 -0
- package/dist/commands/inbox/index.d.ts +2 -1
- package/dist/commands/inbox/index.js +27 -4
- package/dist/commands/login.js +4 -1
- package/dist/commands/machines/list.d.ts +1 -0
- package/dist/commands/machines/list.js +33 -5
- package/dist/commands/memory/approvals/issue.d.ts +18 -0
- package/dist/commands/memory/approvals/issue.js +63 -0
- package/dist/commands/memory/commit.js +5 -2
- package/dist/commands/memory/context.d.ts +3 -2
- package/dist/commands/memory/context.js +9 -11
- package/dist/commands/memory/delete.d.ts +1 -1
- package/dist/commands/memory/list.d.ts +1 -1
- package/dist/commands/memory/list.js +1 -1
- package/dist/commands/memory/mounts/resolve.d.ts +10 -0
- package/dist/commands/memory/mounts/resolve.js +27 -0
- package/dist/commands/memory/proposals/commit.d.ts +18 -0
- package/dist/commands/memory/proposals/commit.js +32 -0
- package/dist/commands/memory/proposals/create.d.ts +18 -0
- package/dist/commands/memory/proposals/create.js +56 -0
- package/dist/commands/memory/proposals/list.d.ts +13 -0
- package/dist/commands/memory/proposals/list.js +31 -0
- package/dist/commands/memory/proposals/promote.d.ts +22 -0
- package/dist/commands/memory/proposals/promote.js +33 -0
- package/dist/commands/memory/proposals/reject.d.ts +16 -0
- package/dist/commands/memory/proposals/reject.js +28 -0
- package/dist/commands/memory/rebuild-index.d.ts +20 -0
- package/dist/commands/memory/rebuild-index.js +25 -0
- package/dist/commands/memory/save.d.ts +1 -1
- package/dist/commands/memory/save.js +1 -1
- package/dist/commands/memory/search.d.ts +6 -3
- package/dist/commands/memory/search.js +27 -3
- package/dist/commands/memory/show.d.ts +1 -1
- package/dist/commands/memory/stores/archive.d.ts +14 -0
- package/dist/commands/memory/stores/archive.js +31 -0
- package/dist/commands/memory/stores/create.d.ts +12 -0
- package/dist/commands/memory/stores/create.js +30 -0
- package/dist/commands/memory/stores/delete.d.ts +15 -0
- package/dist/commands/memory/stores/delete.js +38 -0
- package/dist/commands/memory/stores/list.d.ts +10 -0
- package/dist/commands/memory/stores/list.js +29 -0
- package/dist/commands/memory/stores/show.d.ts +12 -0
- package/dist/commands/memory/stores/show.js +14 -0
- package/dist/commands/memory/stores/update.d.ts +15 -0
- package/dist/commands/memory/stores/update.js +39 -0
- package/dist/commands/memory/sync/delete.d.ts +13 -0
- package/dist/commands/memory/sync/delete.js +35 -0
- package/dist/commands/memory/sync/pull.d.ts +19 -0
- package/dist/commands/memory/sync/pull.js +52 -0
- package/dist/commands/memory/sync/push.d.ts +18 -0
- package/dist/commands/memory/sync/push.js +115 -0
- package/dist/commands/memory/sync/resolve.d.ts +23 -0
- package/dist/commands/memory/sync/resolve.js +27 -0
- package/dist/commands/memory/sync/status.d.ts +9 -0
- package/dist/commands/memory/sync/status.js +22 -0
- package/dist/commands/memory/topics/archive.d.ts +20 -0
- package/dist/commands/memory/topics/archive.js +29 -0
- package/dist/commands/memory/topics/create.d.ts +23 -0
- package/dist/commands/memory/topics/create.js +46 -0
- package/dist/commands/memory/topics/delete.d.ts +22 -0
- package/dist/commands/memory/topics/delete.js +30 -0
- package/dist/commands/memory/topics/forget.d.ts +22 -0
- package/dist/commands/memory/topics/forget.js +29 -0
- package/dist/commands/memory/topics/list.d.ts +13 -0
- package/dist/commands/memory/topics/list.js +22 -0
- package/dist/commands/memory/topics/move.d.ts +22 -0
- package/dist/commands/memory/topics/move.js +26 -0
- package/dist/commands/memory/topics/show.d.ts +17 -0
- package/dist/commands/memory/topics/show.js +21 -0
- package/dist/commands/memory/topics/update.d.ts +23 -0
- package/dist/commands/memory/topics/update.js +27 -0
- package/dist/commands/memory/tree.d.ts +5 -2
- package/dist/commands/memory/tree.js +20 -2
- package/dist/commands/memory/update.d.ts +1 -1
- package/dist/commands/memory/versions/list.d.ts +16 -0
- package/dist/commands/memory/versions/list.js +22 -0
- package/dist/commands/memory/versions/redact.d.ts +21 -0
- package/dist/commands/memory/versions/redact.js +22 -0
- package/dist/commands/memory/versions/restore.d.ts +20 -0
- package/dist/commands/memory/versions/restore.js +16 -0
- package/dist/commands/memory/versions/show.d.ts +15 -0
- package/dist/commands/memory/versions/show.js +17 -0
- package/dist/commands/messages/list.js +25 -8
- package/dist/commands/messages/show.js +10 -0
- package/dist/commands/store/install.js +5 -1
- package/dist/commands/store/releases.js +1 -1
- package/dist/commands/store/update.js +5 -1
- package/dist/commands/subscriptions/cancel.js +5 -1
- package/dist/commands/subscriptions/health.js +5 -1
- package/dist/commands/subscriptions/status.js +5 -1
- package/dist/commands/subscriptions/subscribe.js +5 -1
- package/dist/commands/tasks/activity.d.ts +2 -3
- package/dist/commands/tasks/activity.js +15 -5
- package/dist/commands/tasks/complete.d.ts +18 -150
- package/dist/commands/tasks/complete.js +161 -600
- package/dist/commands/tasks/create.d.ts +5 -0
- package/dist/commands/tasks/create.js +107 -4
- package/dist/commands/tasks/deliverable/add.d.ts +8 -0
- package/dist/commands/tasks/deliverable/add.js +41 -8
- package/dist/commands/tasks/deliverable/confirm.d.ts +5 -5
- package/dist/commands/tasks/deliverable/confirm.js +9 -18
- package/dist/commands/tasks/deliverable/list.d.ts +12 -0
- package/dist/commands/tasks/deliverable/list.js +37 -0
- package/dist/commands/tasks/events/append.d.ts +2 -0
- package/dist/commands/tasks/events/append.js +11 -4
- package/dist/commands/tasks/events/list.d.ts +1 -0
- package/dist/commands/tasks/events/list.js +1 -0
- package/dist/commands/tasks/events/tail.d.ts +1 -0
- package/dist/commands/tasks/events/tail.js +1 -0
- package/dist/commands/tasks/expectations/assess.d.ts +21 -0
- package/dist/commands/tasks/expectations/assess.js +77 -0
- package/dist/commands/tasks/expectations.js +14 -18
- package/dist/commands/tasks/judge.d.ts +1 -0
- package/dist/commands/tasks/judge.js +2 -1
- package/dist/commands/tasks/output.d.ts +2 -11
- package/dist/commands/tasks/output.js +64 -145
- package/dist/commands/tasks/report.d.ts +3 -3
- package/dist/commands/tasks/report.js +64 -41
- package/dist/commands/tasks/resource/add.d.ts +23 -0
- package/dist/commands/tasks/resource/add.js +76 -0
- package/dist/commands/tasks/resource/list.d.ts +13 -0
- package/dist/commands/tasks/resource/list.js +41 -0
- package/dist/commands/tasks/result/show.d.ts +13 -0
- package/dist/commands/tasks/result/show.js +46 -0
- package/dist/commands/tasks/result/submit.d.ts +26 -0
- package/dist/commands/tasks/result/submit.js +134 -0
- package/dist/commands/tasks/resume/save.d.ts +16 -0
- package/dist/commands/tasks/resume/save.js +59 -0
- package/dist/commands/tasks/resume/show.d.ts +13 -0
- package/dist/commands/tasks/resume/show.js +35 -0
- package/dist/commands/tasks/review.d.ts +17 -0
- package/dist/commands/tasks/review.js +54 -0
- package/dist/commands/tasks/runs.js +5 -0
- package/dist/commands/tasks/timeline.d.ts +2 -2
- package/dist/commands/tasks/timeline.js +10 -23
- package/dist/commands/tasks/updates/add.d.ts +22 -0
- package/dist/commands/tasks/updates/add.js +101 -0
- package/dist/commands/tasks/updates/list.d.ts +15 -0
- package/dist/commands/tasks/updates/list.js +57 -0
- package/dist/commands/tasks/waive.d.ts +1 -0
- package/dist/commands/tasks/waive.js +2 -1
- package/dist/lib/agentic-stream.d.ts +257 -0
- package/dist/lib/agentic-stream.js +490 -33
- package/dist/lib/balance.d.ts +8 -0
- package/dist/lib/commitment-product.d.ts +10 -1
- package/dist/lib/commitment-product.js +66 -2
- package/dist/lib/commitments.d.ts +2 -1
- package/dist/lib/commitments.js +1 -0
- package/dist/lib/conversation-search.d.ts +3 -0
- package/dist/lib/conversation-search.js +75 -0
- package/dist/lib/execution-target.d.ts +21 -0
- package/dist/lib/execution-target.js +22 -6
- package/dist/lib/harnesses.d.ts +82 -6
- package/dist/lib/harnesses.js +30 -2
- package/dist/lib/hosted-machines.js +9 -0
- package/dist/lib/inbox.d.ts +2 -1
- package/dist/lib/machines.d.ts +17 -0
- package/dist/lib/machines.js +29 -0
- package/dist/lib/managed-agent-keys.d.ts +104 -0
- package/dist/lib/managed-agent-keys.js +50 -0
- package/dist/lib/memory-scope.d.ts +4 -3
- package/dist/lib/memory-scope.js +9 -9
- package/dist/lib/memory-sync.d.ts +114 -0
- package/dist/lib/memory-sync.js +730 -0
- package/dist/lib/message-provenance.d.ts +42 -0
- package/dist/lib/message-provenance.js +89 -0
- package/dist/lib/scoped-memory-command.d.ts +68 -0
- package/dist/lib/scoped-memory-command.js +183 -0
- package/dist/lib/session-task-endpoints.d.ts +1 -1
- package/dist/lib/session-task-endpoints.js +7 -0
- package/dist/lib/sky-code-broker.d.ts +47 -0
- package/dist/lib/sky-code-broker.js +50 -0
- package/dist/lib/sky-code-doctor.js +10 -1
- package/dist/lib/task-artifact-flags.d.ts +2 -0
- package/dist/lib/task-artifact-flags.js +7 -0
- package/dist/lib/task-execution.d.ts +4 -5
- package/dist/lib/task-execution.js +4 -5
- package/dist/lib/task-extras.d.ts +1 -5
- package/dist/lib/task-extras.js +1 -5
- package/dist/lib/task-transcript.d.ts +5 -7
- package/dist/lib/task-transcript.js +8 -16
- package/dist/lib/tasks.d.ts +7 -21
- package/dist/lib/tasks.js +17 -20
- package/dist/lib/triggers.d.ts +39 -1
- package/dist/lib/triggers.js +70 -2
- package/dist/lib/usage-discovery.d.ts +17 -1
- package/dist/lib/usage-discovery.js +17 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +3733 -3618
- package/oclif.manifest.json +16201 -10377
- package/package.json +26 -5
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* managed-agent-keys.ts — request client for `/api/admin/mgmt-keys`.
|
|
3
|
+
*
|
|
4
|
+
* ## Why this file exists
|
|
5
|
+
*
|
|
6
|
+
* The Managed Agents API (`/api/v1/*` — environments, agent releases, sessions,
|
|
7
|
+
* events, vaults) authenticates with an `osk_<live|test>_<secret>` key, and the
|
|
8
|
+
* only route that mints one is `POST /api/admin/mgmt-keys`. Nothing in the CLI
|
|
9
|
+
* reached it: a search of every command directory found no reference to
|
|
10
|
+
* `mgmt-keys` or `/api/v1` at all.
|
|
11
|
+
*
|
|
12
|
+
* So a headless operator, or a coding agent running locally, could be told by
|
|
13
|
+
* `/v1` that its credential was missing and had no command to mint one. The
|
|
14
|
+
* documented path was the dashboard, which a machine cannot open. That gap was
|
|
15
|
+
* recorded as the secondary half of OSK-7932, whose primary half was that the
|
|
16
|
+
* server-side pepper had never been configured in any environment — the API
|
|
17
|
+
* could not issue a key, and there was also no way to ask it to.
|
|
18
|
+
*
|
|
19
|
+
* ## Not the same thing as `skrr token`
|
|
20
|
+
*
|
|
21
|
+
* `skrr token` / `skrr create-token` mint a long-lived CLI token for
|
|
22
|
+
* bootstrapping a daemon on a headless machine — that is this CLI's own auth.
|
|
23
|
+
* These are API keys for a different surface, held by a Space, and presented by
|
|
24
|
+
* whatever calls `/api/v1`. The CLI already keeps `balance` and
|
|
25
|
+
* `payments wallet` apart for the same reason: two things called "credit" that
|
|
26
|
+
* are unrelated, where reading one for the other tells you something false.
|
|
27
|
+
*
|
|
28
|
+
* ## Inline path literals
|
|
29
|
+
*
|
|
30
|
+
* `domain-api-parity` resolves a command to an endpoint by reading these
|
|
31
|
+
* strings. A helper that assembles the URL is opaque to it, so the endpoint
|
|
32
|
+
* would read as unreachable and get allow-listed — a check going green on an
|
|
33
|
+
* assertion it never made.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* A key as the API returns it, in the API's OWN field names.
|
|
37
|
+
*
|
|
38
|
+
* snake_case, and mirrored rather than translated. `toPublic` in
|
|
39
|
+
* `routes/adminMgmtKeys.js` is the contract; a camelCase interface here would
|
|
40
|
+
* silently produce `undefined` for every field, which is precisely what the
|
|
41
|
+
* first version of this file did — it invented `createdAt`/`revokedAt` and an
|
|
42
|
+
* `env` that does not exist, and the list command printed nothing while the API
|
|
43
|
+
* was returning rows.
|
|
44
|
+
*
|
|
45
|
+
* There is no `env` field. The environment is encoded in `prefix`
|
|
46
|
+
* (`osk_live_…` / `osk_test_…`), which is also all a listing ever reveals of a
|
|
47
|
+
* secret.
|
|
48
|
+
*/
|
|
49
|
+
export interface ManagedAgentKey {
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
prefix?: string;
|
|
53
|
+
last_four?: string;
|
|
54
|
+
scopes: string[];
|
|
55
|
+
space_id?: string;
|
|
56
|
+
created_at?: string;
|
|
57
|
+
last_used_at?: string | null;
|
|
58
|
+
revoked_at?: string | null;
|
|
59
|
+
expires_at?: string | null;
|
|
60
|
+
rate_limit_override?: unknown;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The mint response: the public projection, FLAT, plus the secret.
|
|
64
|
+
*
|
|
65
|
+
* `secret` is returned exactly once — there is no endpoint that reveals it
|
|
66
|
+
* again — so a caller that discards this field has lost the credential and must
|
|
67
|
+
* rotate. The command layer says so where the value is printed rather than in a
|
|
68
|
+
* footnote.
|
|
69
|
+
*/
|
|
70
|
+
export type ManagedAgentKeyMint = ManagedAgentKey & {
|
|
71
|
+
secret: string;
|
|
72
|
+
secret_warning?: string;
|
|
73
|
+
/** Present on a rotate: the id of the key this one replaces. */
|
|
74
|
+
rotated_from?: string;
|
|
75
|
+
};
|
|
76
|
+
export interface CreateManagedAgentKeyInput {
|
|
77
|
+
spaceId: string;
|
|
78
|
+
name: string;
|
|
79
|
+
env?: 'live' | 'test';
|
|
80
|
+
scopes?: string[];
|
|
81
|
+
/** ISO 8601. The route refuses a value in the past. */
|
|
82
|
+
expiresAt?: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Mint a key for a Space.
|
|
86
|
+
*
|
|
87
|
+
* Space-owner only, enforced server-side — a member cannot mint against a Space
|
|
88
|
+
* they do not own, and the CLI does not pre-check that: a client-side guess at
|
|
89
|
+
* an authorization answer is one more place for the two to disagree.
|
|
90
|
+
*/
|
|
91
|
+
export declare function createManagedAgentKey(input: CreateManagedAgentKeyInput): Promise<ManagedAgentKeyMint>;
|
|
92
|
+
/** Every key on a Space. Revoked rows are included, with `revokedAt` set. */
|
|
93
|
+
export declare function listManagedAgentKeys(spaceId: string): Promise<ManagedAgentKey[]>;
|
|
94
|
+
/** Revoke a key. Irreversible — a revoked key is never re-enabled, only replaced. */
|
|
95
|
+
export declare function revokeManagedAgentKey(id: string, spaceId: string): Promise<{
|
|
96
|
+
id?: string;
|
|
97
|
+
revoked?: boolean;
|
|
98
|
+
}>;
|
|
99
|
+
/**
|
|
100
|
+
* Rotate a key: mint a replacement secret for the same row.
|
|
101
|
+
*
|
|
102
|
+
* Returns a secret under the same once-only rule as `create`.
|
|
103
|
+
*/
|
|
104
|
+
export declare function rotateManagedAgentKey(id: string, spaceId: string): Promise<ManagedAgentKeyMint>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createManagedAgentKey = createManagedAgentKey;
|
|
4
|
+
exports.listManagedAgentKeys = listManagedAgentKeys;
|
|
5
|
+
exports.revokeManagedAgentKey = revokeManagedAgentKey;
|
|
6
|
+
exports.rotateManagedAgentKey = rotateManagedAgentKey;
|
|
7
|
+
const api_fetch_1 = require("./api-fetch");
|
|
8
|
+
/**
|
|
9
|
+
* Mint a key for a Space.
|
|
10
|
+
*
|
|
11
|
+
* Space-owner only, enforced server-side — a member cannot mint against a Space
|
|
12
|
+
* they do not own, and the CLI does not pre-check that: a client-side guess at
|
|
13
|
+
* an authorization answer is one more place for the two to disagree.
|
|
14
|
+
*/
|
|
15
|
+
async function createManagedAgentKey(input) {
|
|
16
|
+
return (0, api_fetch_1.apiFetch)('/api/admin/mgmt-keys', {
|
|
17
|
+
method: 'POST',
|
|
18
|
+
body: {
|
|
19
|
+
space_id: input.spaceId,
|
|
20
|
+
name: input.name,
|
|
21
|
+
...(input.env ? { env: input.env } : {}),
|
|
22
|
+
...(input.scopes ? { scopes: input.scopes } : {}),
|
|
23
|
+
...(input.expiresAt ? { expires_at: input.expiresAt } : {}),
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/** Every key on a Space. Revoked rows are included, with `revokedAt` set. */
|
|
28
|
+
async function listManagedAgentKeys(spaceId) {
|
|
29
|
+
// `{ data: [...] }` — the route's envelope. Guessed as `{ keys }` first, which
|
|
30
|
+
// returned an empty list against a space that had a key, and reported "No API
|
|
31
|
+
// keys on this space." That is the failure shape worth noting: a wrong
|
|
32
|
+
// envelope does not error, it reports absence.
|
|
33
|
+
const res = await (0, api_fetch_1.apiFetch)(`/api/admin/mgmt-keys?space_id=${encodeURIComponent(spaceId)}`);
|
|
34
|
+
return res?.data || [];
|
|
35
|
+
}
|
|
36
|
+
/** Revoke a key. Irreversible — a revoked key is never re-enabled, only replaced. */
|
|
37
|
+
async function revokeManagedAgentKey(id, spaceId) {
|
|
38
|
+
return (0, api_fetch_1.apiFetch)(`/api/admin/mgmt-keys/${encodeURIComponent(id)}?space_id=${encodeURIComponent(spaceId)}`, { method: 'DELETE' });
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Rotate a key: mint a replacement secret for the same row.
|
|
42
|
+
*
|
|
43
|
+
* Returns a secret under the same once-only rule as `create`.
|
|
44
|
+
*/
|
|
45
|
+
async function rotateManagedAgentKey(id, spaceId) {
|
|
46
|
+
return (0, api_fetch_1.apiFetch)(`/api/admin/mgmt-keys/${encodeURIComponent(id)}/rotate`, {
|
|
47
|
+
method: 'POST',
|
|
48
|
+
body: { space_id: spaceId },
|
|
49
|
+
});
|
|
50
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { MemoryScope } from '@skrr-ai/data-provider';
|
|
2
2
|
/**
|
|
3
|
-
* Shared `--agent` / `--tier` / `--workspace` flags for
|
|
3
|
+
* Shared `--agent` / `--tier` / `--pool-workspace` flags for compatibility Memory commands.
|
|
4
4
|
*
|
|
5
5
|
* A memory record lives in exactly one pool. These flags select which:
|
|
6
6
|
* - (default) owner pool → /api/memories
|
|
7
7
|
* - --agent <id> a specific agent → /api/agents/:id/memories
|
|
8
8
|
* - --tier user cross-agent user → /api/users/me/memories
|
|
9
9
|
* - --tier workspace a workspace pool → /api/workspaces/:id/memories
|
|
10
|
-
* (requires --workspace <id>)
|
|
10
|
+
* (requires --pool-workspace <id>)
|
|
11
11
|
*
|
|
12
12
|
* Spread into a command's `flags` alongside its own. Resolve with
|
|
13
13
|
* `resolveMemoryScope(flags)` into the `MemoryScope` the data-service accepts.
|
|
@@ -15,11 +15,12 @@ import type { MemoryScope } from '@skrr-ai/data-provider';
|
|
|
15
15
|
export declare const memoryScopeFlags: {
|
|
16
16
|
agent: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
17
17
|
tier: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
18
|
-
workspace: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
18
|
+
'pool-workspace': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
19
|
};
|
|
20
20
|
export interface MemoryScopeFlagValues {
|
|
21
21
|
agent?: string;
|
|
22
22
|
tier?: string;
|
|
23
|
+
'pool-workspace'?: string;
|
|
23
24
|
workspace?: string;
|
|
24
25
|
}
|
|
25
26
|
/**
|
package/dist/lib/memory-scope.js
CHANGED
|
@@ -6,14 +6,14 @@ exports.resolveMemoryScopeOrFail = resolveMemoryScopeOrFail;
|
|
|
6
6
|
exports.describeMemoryScope = describeMemoryScope;
|
|
7
7
|
const core_1 = require("@oclif/core");
|
|
8
8
|
/**
|
|
9
|
-
* Shared `--agent` / `--tier` / `--workspace` flags for
|
|
9
|
+
* Shared `--agent` / `--tier` / `--pool-workspace` flags for compatibility Memory commands.
|
|
10
10
|
*
|
|
11
11
|
* A memory record lives in exactly one pool. These flags select which:
|
|
12
12
|
* - (default) owner pool → /api/memories
|
|
13
13
|
* - --agent <id> a specific agent → /api/agents/:id/memories
|
|
14
14
|
* - --tier user cross-agent user → /api/users/me/memories
|
|
15
15
|
* - --tier workspace a workspace pool → /api/workspaces/:id/memories
|
|
16
|
-
* (requires --workspace <id>)
|
|
16
|
+
* (requires --pool-workspace <id>)
|
|
17
17
|
*
|
|
18
18
|
* Spread into a command's `flags` alongside its own. Resolve with
|
|
19
19
|
* `resolveMemoryScope(flags)` into the `MemoryScope` the data-service accepts.
|
|
@@ -26,8 +26,8 @@ exports.memoryScopeFlags = {
|
|
|
26
26
|
description: 'Memory pool tier to target (default: owner)',
|
|
27
27
|
options: ['owner', 'user', 'workspace'],
|
|
28
28
|
}),
|
|
29
|
-
workspace: core_1.Flags.string({
|
|
30
|
-
description: '
|
|
29
|
+
'pool-workspace': core_1.Flags.string({
|
|
30
|
+
description: 'Compatibility Memory pool workspace id (required with --tier workspace; distinct from global --workspace request context)',
|
|
31
31
|
}),
|
|
32
32
|
};
|
|
33
33
|
/**
|
|
@@ -40,14 +40,14 @@ function resolveMemoryScope(flags) {
|
|
|
40
40
|
if (flags.agent && tier !== 'owner') {
|
|
41
41
|
throw new Error('--agent cannot be combined with --tier user|workspace.');
|
|
42
42
|
}
|
|
43
|
-
if (flags
|
|
44
|
-
throw new Error('--workspace is only valid with --tier workspace.');
|
|
43
|
+
if (flags['pool-workspace'] && tier !== 'workspace') {
|
|
44
|
+
throw new Error('--pool-workspace is only valid with --tier workspace.');
|
|
45
45
|
}
|
|
46
46
|
if (tier === 'workspace') {
|
|
47
|
-
if (!flags
|
|
48
|
-
throw new Error('--workspace <id> is required when --tier workspace.');
|
|
47
|
+
if (!flags['pool-workspace']) {
|
|
48
|
+
throw new Error('--pool-workspace <id> is required when --tier workspace. Global --workspace selects request context and cannot select a Memory pool.');
|
|
49
49
|
}
|
|
50
|
-
return { tier: 'workspace', workspaceId: flags
|
|
50
|
+
return { tier: 'workspace', workspaceId: flags['pool-workspace'] };
|
|
51
51
|
}
|
|
52
52
|
if (tier === 'user') {
|
|
53
53
|
return { tier: 'user' };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export declare const MEMORY_SYNC_MANIFEST = ".memory-sync";
|
|
2
|
+
export declare const MEMORY_SYNC_BASIS = ".memory-sync-basis";
|
|
3
|
+
export declare const MEMORY_SYNC_CONFLICTS = ".memory-conflicts";
|
|
4
|
+
export declare const MEMORY_SYNC_TOMBSTONES = ".memory-tombstones";
|
|
5
|
+
export interface RemoteMemoryEntry {
|
|
6
|
+
memoryId: string;
|
|
7
|
+
path: string;
|
|
8
|
+
versionId: string;
|
|
9
|
+
revision: number;
|
|
10
|
+
contentHash: string | null;
|
|
11
|
+
document: string;
|
|
12
|
+
}
|
|
13
|
+
export interface MemorySyncSnapshot {
|
|
14
|
+
contractVersion: 1;
|
|
15
|
+
storeId: string;
|
|
16
|
+
owner: {
|
|
17
|
+
kind: 'agent' | 'space';
|
|
18
|
+
id: string;
|
|
19
|
+
};
|
|
20
|
+
access: 'read_only' | 'read_write';
|
|
21
|
+
authorizationGeneration: number;
|
|
22
|
+
cursor: string;
|
|
23
|
+
storeRevision: number;
|
|
24
|
+
index: string;
|
|
25
|
+
entries: RemoteMemoryEntry[];
|
|
26
|
+
}
|
|
27
|
+
export interface MemorySyncManifest {
|
|
28
|
+
contractVersion: 1;
|
|
29
|
+
storeId: string;
|
|
30
|
+
ownerUri: string;
|
|
31
|
+
access: 'read_only' | 'read_write' | 'revoked';
|
|
32
|
+
authorizationGeneration: number;
|
|
33
|
+
cursor: string;
|
|
34
|
+
updatedAt: string;
|
|
35
|
+
}
|
|
36
|
+
export interface MemorySyncChange {
|
|
37
|
+
cursor: string;
|
|
38
|
+
storeId: string;
|
|
39
|
+
memoryId?: string;
|
|
40
|
+
operation: 'upsert' | 'remove' | 'redact' | 'scope_reset';
|
|
41
|
+
authorizationGeneration: number;
|
|
42
|
+
}
|
|
43
|
+
export interface MemorySyncChanges {
|
|
44
|
+
contractVersion: 1;
|
|
45
|
+
storeId: string;
|
|
46
|
+
authorizationGeneration: number;
|
|
47
|
+
storeRevision?: number;
|
|
48
|
+
after: string;
|
|
49
|
+
cursor: string;
|
|
50
|
+
hasMore?: boolean;
|
|
51
|
+
index?: string;
|
|
52
|
+
resetRequired?: boolean;
|
|
53
|
+
reason?: string;
|
|
54
|
+
entries?: Array<{
|
|
55
|
+
change: MemorySyncChange;
|
|
56
|
+
head?: RemoteMemoryEntry | null;
|
|
57
|
+
}>;
|
|
58
|
+
}
|
|
59
|
+
export interface LocalMutation {
|
|
60
|
+
operation: 'encode' | 'reconsolidate' | 'delete';
|
|
61
|
+
input: Record<string, unknown>;
|
|
62
|
+
file: string;
|
|
63
|
+
}
|
|
64
|
+
export declare function fileForMemoryPath(memoryPath: string): string;
|
|
65
|
+
export declare function readMaterializationBinding(rootInput: string): Promise<{
|
|
66
|
+
manifest: MemorySyncManifest | null;
|
|
67
|
+
cursor: string | null;
|
|
68
|
+
}>;
|
|
69
|
+
export declare function assertMaterializationSpaceContext(manifest: MemorySyncManifest | null, spaceId?: string): void;
|
|
70
|
+
export declare function assertMaterializationStore(manifest: MemorySyncManifest | null, storeId: string): void;
|
|
71
|
+
export declare function pullSnapshot(rootInput: string, snapshot: MemorySyncSnapshot, { dryRun }?: {
|
|
72
|
+
dryRun?: boolean | undefined;
|
|
73
|
+
}): Promise<{
|
|
74
|
+
changed: number;
|
|
75
|
+
conflicts: number;
|
|
76
|
+
cursor: string;
|
|
77
|
+
dryRun: boolean;
|
|
78
|
+
}>;
|
|
79
|
+
export declare function pullChanges(rootInput: string, delta: MemorySyncChanges, { dryRun }?: {
|
|
80
|
+
dryRun?: boolean | undefined;
|
|
81
|
+
}): Promise<{
|
|
82
|
+
changed: number;
|
|
83
|
+
conflicts: number;
|
|
84
|
+
cursor: string;
|
|
85
|
+
dryRun: boolean;
|
|
86
|
+
}>;
|
|
87
|
+
export declare function planPush(rootInput: string, { recordConflicts }?: {
|
|
88
|
+
recordConflicts?: boolean;
|
|
89
|
+
}): Promise<{
|
|
90
|
+
manifest: MemorySyncManifest;
|
|
91
|
+
mutations: LocalMutation[];
|
|
92
|
+
conflicts: number;
|
|
93
|
+
unrecognizedFiles: string[];
|
|
94
|
+
nextActions: string[];
|
|
95
|
+
}>;
|
|
96
|
+
export declare function syncStatus(rootInput: string): Promise<Record<string, unknown>>;
|
|
97
|
+
export declare function stageLocalDelete(rootInput: string, memoryId: string): Promise<{
|
|
98
|
+
memoryId: string;
|
|
99
|
+
file: string;
|
|
100
|
+
expectedVersionId: string;
|
|
101
|
+
tombstoneFile: string;
|
|
102
|
+
}>;
|
|
103
|
+
export declare function resolveConflict(rootInput: string, conflictId: string, strategy: string, manualContent?: string): Promise<{
|
|
104
|
+
resolved: boolean;
|
|
105
|
+
strategy: string;
|
|
106
|
+
}>;
|
|
107
|
+
export declare function revokeMaterialization(rootInput: string, generation: number): Promise<{
|
|
108
|
+
removed: number;
|
|
109
|
+
}>;
|
|
110
|
+
export declare function boundedFinalFlush<T>(flush: () => Promise<T>, timeoutMs?: number): Promise<{
|
|
111
|
+
flushed: boolean;
|
|
112
|
+
result?: T;
|
|
113
|
+
unsynced?: true;
|
|
114
|
+
}>;
|