maka-agent 0.2.0-dev.69.20261004 → 0.2.0-dev.74.20261008
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/LICENSE +3 -3
- package/THIRD_PARTY_NOTICES.txt +2 -2
- package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
- package/node_modules/@maka/core/dist/archive-retention.js +109 -0
- package/node_modules/@maka/core/dist/runtime-policy/connection-catalog-codec.js +8 -4
- package/node_modules/@maka/core/package.json +1 -0
- package/node_modules/@maka/mcp/dist/oauth.js +7 -2
- package/node_modules/@maka/mcp/package.json +1 -1
- package/node_modules/@maka/runtime-host/dist/protocol/connection-effects.js +11 -2
- package/node_modules/@maka/runtime-host/dist/protocol/index.js +6 -1
- package/node_modules/@maka/runtime-host/dist/protocol/operations.js +5 -1
- package/node_modules/@maka/runtime-host/dist/protocol/storage-retention.js +144 -0
- package/node_modules/@maka/runtime-host/dist/server/archive-retention-coordinator.js +546 -0
- package/node_modules/@maka/runtime-host/dist/server/connection-effect-coordinator.js +1 -1
- package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +12 -0
- package/node_modules/@maka/runtime-host/dist/server/session-retirement-coordinator.js +73 -7
- package/node_modules/@maka/runtime-host/dist/server/storage-maintenance.js +34 -4
- package/node_modules/@maka/storage/dist/archive-retention-store.js +124 -0
- package/node_modules/@maka/storage/dist/context-offload-store.js +4 -0
- package/node_modules/@maka/storage/dist/execution-stores.js +3 -0
- package/node_modules/@maka/storage/dist/runtime-policy/connection-catalog-document.js +48 -16
- package/node_modules/@maka/storage/dist/runtime-policy/coordinator.js +2 -2
- package/node_modules/@maka/storage/dist/runtime-policy/document-io.js +1 -1
- package/node_modules/@maka/storage/dist/runtime-policy-stores.js +1 -1
- package/node_modules/@maka/storage/dist/session-bundle-policy.js +9 -0
- package/node_modules/@maka/storage/dist/session-store.js +17 -0
- package/node_modules/@maka/storage/dist/sqlite-context-offload-store.js +34 -0
- package/node_modules/@maka/storage/dist/sqlite-session-catalog-query.js +48 -5
- package/node_modules/@maka/storage/dist/sqlite-session-metadata-store.js +111 -1
- package/node_modules/@maka/storage/dist/sqlite-session-role-scope.js +3 -3
- package/node_modules/@maka/storage/dist/storage-writer-composition.js +2 -0
- package/node_modules/@maka/storage/package.json +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/index-D_CiY-T3.d.cts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/index-D_QDtbiv.d.mts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/index.cjs +100 -55
- package/node_modules/@modelcontextprotocol/client/dist/index.d.cts.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/index.d.mts.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/index.mjs +100 -55
- package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.cjs +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.mjs +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/{src-D0qEN74R.cjs → src-oZBjf3U1.cjs} +21 -4
- package/node_modules/@modelcontextprotocol/client/dist/{src-DDAAhLnO.mjs → src-xKF0PJN-.mjs} +16 -5
- package/node_modules/@modelcontextprotocol/client/dist/stdio.cjs +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/stdio.mjs +1 -1
- package/node_modules/@modelcontextprotocol/client/node_modules/@modelcontextprotocol/core/dist/{auth--n_Yzytt.d.cts.map → auth-Anm-lwWi.d.mts.map} +1 -1
- package/node_modules/@modelcontextprotocol/client/node_modules/@modelcontextprotocol/core/dist/{auth-CGP0BDVq.mjs → auth-BNDyLTqp.mjs} +5 -3
- package/node_modules/@modelcontextprotocol/client/node_modules/@modelcontextprotocol/core/dist/{auth-4-zilcqg.cjs → auth-D1CeV_Jr.cjs} +5 -3
- package/node_modules/@modelcontextprotocol/client/node_modules/@modelcontextprotocol/core/dist/{auth-YUQV3RRv.d.mts.map → auth-V9XJSCfa.d.cts.map} +1 -1
- package/node_modules/@modelcontextprotocol/client/node_modules/@modelcontextprotocol/core/dist/index.cjs +1 -1
- package/node_modules/@modelcontextprotocol/client/node_modules/@modelcontextprotocol/core/dist/index.mjs +1 -1
- package/node_modules/@modelcontextprotocol/client/node_modules/@modelcontextprotocol/core/dist/internal.cjs +1 -1
- package/node_modules/@modelcontextprotocol/client/node_modules/@modelcontextprotocol/core/dist/internal.mjs +1 -1
- package/node_modules/@modelcontextprotocol/client/node_modules/@modelcontextprotocol/core/package.json +1 -1
- package/node_modules/@modelcontextprotocol/client/package.json +3 -3
- package/package.json +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/index-BCtJi0p5.d.mts.map +0 -1
- package/node_modules/@modelcontextprotocol/client/dist/index-CEk3qkZM.d.cts.map +0 -1
package/LICENSE
CHANGED
|
@@ -385,10 +385,10 @@ SOFTWARE.
|
|
|
385
385
|
|
|
386
386
|
Model Context Protocol client dependency patch
|
|
387
387
|
|
|
388
|
-
Source: https://www.npmjs.com/package/@modelcontextprotocol/client/v/2.
|
|
388
|
+
Source: https://www.npmjs.com/package/@modelcontextprotocol/client/v/2.2.0
|
|
389
389
|
Repository: https://github.com/modelcontextprotocol/typescript-sdk
|
|
390
|
-
Version: 2.
|
|
391
|
-
Dependency patch: patches/@modelcontextprotocol+client+2.
|
|
390
|
+
Version: 2.2.0
|
|
391
|
+
Dependency patch: patches/@modelcontextprotocol+client+2.2.0.patch
|
|
392
392
|
Copyright (c) 2024-2025 Model Context Protocol a Series of LF Projects, LLC.
|
|
393
393
|
Declared package license: MIT
|
|
394
394
|
|
package/THIRD_PARTY_NOTICES.txt
CHANGED
|
@@ -752,7 +752,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
752
752
|
|
|
753
753
|
================================================================================
|
|
754
754
|
|
|
755
|
-
Package: @modelcontextprotocol/client@2.
|
|
755
|
+
Package: @modelcontextprotocol/client@2.2.0
|
|
756
756
|
Declared license: MIT
|
|
757
757
|
Selected license: MIT
|
|
758
758
|
Repository: git+https://github.com/modelcontextprotocol/typescript-sdk.git
|
|
@@ -977,7 +977,7 @@ the full license text.
|
|
|
977
977
|
|
|
978
978
|
================================================================================
|
|
979
979
|
|
|
980
|
-
Package: @modelcontextprotocol/core@2.
|
|
980
|
+
Package: @modelcontextprotocol/core@2.2.0
|
|
981
981
|
Declared license: MIT
|
|
982
982
|
Selected license: MIT
|
|
983
983
|
Repository: git+https://github.com/modelcontextprotocol/typescript-sdk.git
|
|
Binary file
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
|
4
|
+
* distributed with this work for additional information
|
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
|
7
|
+
* "License"); you may not use this file except in compliance
|
|
8
|
+
* with the License. You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
|
13
|
+
* software distributed under the License is distributed on an
|
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
* KIND, either express or implied. See the License for the
|
|
16
|
+
* specific language governing permissions and limitations
|
|
17
|
+
* under the License.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Opt-in retention for archived tasks (#5899): when a Runtime Host enables it,
|
|
21
|
+
* the Host deletes archived tasks once they have been archived for longer than
|
|
22
|
+
* the chosen number of days. These are the rules both the Host and its Clients
|
|
23
|
+
* read; the Host alone decides and deletes.
|
|
24
|
+
*/
|
|
25
|
+
/** The retention periods a Host offers. */
|
|
26
|
+
export const ARCHIVE_RETENTION_DAYS = [30, 60, 90];
|
|
27
|
+
export const ARCHIVE_RETENTION_DAY_MS = 24 * 60 * 60 * 1000;
|
|
28
|
+
export function isArchiveRetentionDays(value) {
|
|
29
|
+
return ARCHIVE_RETENTION_DAYS.some((days) => days === value);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* When a task's retention clock starts: when it was archived, but never before
|
|
33
|
+
* the policy was enabled. Enabling therefore never deletes a backlog at once,
|
|
34
|
+
* and a task archived before the Host recorded the time counts from enablement.
|
|
35
|
+
*/
|
|
36
|
+
export function archiveRetentionClockStart(archivedAt, enabledAt) {
|
|
37
|
+
return Math.max(archivedAt ?? enabledAt, enabledAt);
|
|
38
|
+
}
|
|
39
|
+
/** A task whose clock started at `start` is eligible once the clock passes this instant. */
|
|
40
|
+
export function archiveRetentionDeadline(start, days) {
|
|
41
|
+
return start + days * ARCHIVE_RETENTION_DAY_MS;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A forward gap in the wall clock larger than this, between two times the Host
|
|
45
|
+
* observed, holds deletions: the smaller of the retention window and 7 days.
|
|
46
|
+
* A wrong clock set far ahead would otherwise make a whole backlog eligible at
|
|
47
|
+
* once, and so would a long time offline, which a hold costs only a day.
|
|
48
|
+
*/
|
|
49
|
+
export function archiveRetentionGapThreshold(days) {
|
|
50
|
+
return Math.min(days, 7) * ARCHIVE_RETENTION_DAY_MS;
|
|
51
|
+
}
|
|
52
|
+
/** How long a forward gap holds deletions after it is observed. */
|
|
53
|
+
export const ARCHIVE_RETENTION_HOLD_MS = 24 * 60 * 60 * 1000;
|
|
54
|
+
/**
|
|
55
|
+
* The one decoder of the results the Host records and reports, shared by the
|
|
56
|
+
* State Root document and the protocol. `fail` builds the caller's own error.
|
|
57
|
+
*/
|
|
58
|
+
export function decodeArchiveRetentionSweep(value, fail) {
|
|
59
|
+
const sweep = exactRecord(value, 'retention sweep', ['at', 'deleted', 'skippedBusy', 'needsReview', 'failed'], ['paused'], fail);
|
|
60
|
+
if (sweep.paused !== undefined && sweep.paused !== true) {
|
|
61
|
+
throw fail('Invalid retention sweep paused');
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
at: count(sweep.at, 'retention sweep at', fail),
|
|
65
|
+
deleted: count(sweep.deleted, 'retention sweep deleted', fail),
|
|
66
|
+
skippedBusy: count(sweep.skippedBusy, 'retention sweep skippedBusy', fail),
|
|
67
|
+
needsReview: count(sweep.needsReview, 'retention sweep needsReview', fail),
|
|
68
|
+
failed: count(sweep.failed, 'retention sweep failed', fail),
|
|
69
|
+
...(sweep.paused === true ? { paused: true } : {}),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export function decodeArchiveRetentionDeletion(value, fail) {
|
|
73
|
+
const deletion = exactRecord(value, 'retention deletion', ['at', 'count'], ['bytes'], fail);
|
|
74
|
+
return {
|
|
75
|
+
at: count(deletion.at, 'retention deletion at', fail),
|
|
76
|
+
count: count(deletion.count, 'retention deletion count', fail),
|
|
77
|
+
...(deletion.bytes === undefined
|
|
78
|
+
? {}
|
|
79
|
+
: { bytes: count(deletion.bytes, 'retention deletion bytes', fail) }),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export function decodeArchiveRetentionHold(value, fail) {
|
|
83
|
+
const hold = exactRecord(value, 'retention hold', ['since', 'detectedAt', 'until'], [], fail);
|
|
84
|
+
const since = count(hold.since, 'retention hold since', fail);
|
|
85
|
+
const detectedAt = count(hold.detectedAt, 'retention hold detectedAt', fail);
|
|
86
|
+
const until = count(hold.until, 'retention hold until', fail);
|
|
87
|
+
if (since > detectedAt || detectedAt > until)
|
|
88
|
+
throw fail('Invalid retention hold order');
|
|
89
|
+
return { since, detectedAt, until };
|
|
90
|
+
}
|
|
91
|
+
function exactRecord(value, label, required, optional, fail) {
|
|
92
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
93
|
+
throw fail(`Invalid ${label}`);
|
|
94
|
+
}
|
|
95
|
+
const record = value;
|
|
96
|
+
if (Object.keys(record).some((key) => !required.includes(key) && !optional.includes(key))) {
|
|
97
|
+
throw fail(`Unknown ${label} field`);
|
|
98
|
+
}
|
|
99
|
+
if (required.some((key) => !Object.hasOwn(record, key))) {
|
|
100
|
+
throw fail(`Invalid ${label} fields`);
|
|
101
|
+
}
|
|
102
|
+
return record;
|
|
103
|
+
}
|
|
104
|
+
function count(value, label, fail) {
|
|
105
|
+
if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 0) {
|
|
106
|
+
throw fail(`Invalid ${label}`);
|
|
107
|
+
}
|
|
108
|
+
return value;
|
|
109
|
+
}
|
|
@@ -63,13 +63,17 @@ export function normalizeRemoveCatalogConnectionInput(value) {
|
|
|
63
63
|
return { expected: decodeConnectionVersionBasis(input.expected) };
|
|
64
64
|
}
|
|
65
65
|
export function normalizeSetDefaultConnectionTargetInput(value) {
|
|
66
|
-
const input = exactRecord(value, 'set default target input', [
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
const input = exactRecord(value, 'set default target input', ['expectedCatalogRevision', 'target', 'enableModel'], ['expectedCatalogRevision', 'target']);
|
|
67
|
+
const enableModel = input.enableModel === undefined
|
|
68
|
+
? undefined
|
|
69
|
+
: booleanValue(input.enableModel, 'enable default model');
|
|
70
|
+
if (enableModel && input.target === null) {
|
|
71
|
+
throw domainError('Enabling a model requires a default target');
|
|
72
|
+
}
|
|
70
73
|
return {
|
|
71
74
|
expectedCatalogRevision: revisionValue(input.expectedCatalogRevision, 'set default target expected catalog revision'),
|
|
72
75
|
target: input.target === null ? null : decodeConnectionTarget(input.target),
|
|
76
|
+
...(enableModel === undefined ? {} : { enableModel }),
|
|
73
77
|
};
|
|
74
78
|
}
|
|
75
79
|
export function normalizeConnectionCatalogEntryDraft(value) {
|
|
@@ -143,6 +143,7 @@
|
|
|
143
143
|
"./project": "./dist/project.js",
|
|
144
144
|
"./pty-output-view": "./dist/pty-output-view.js",
|
|
145
145
|
"./relative-time": "./dist/relative-time.js",
|
|
146
|
+
"./archive-retention": "./dist/archive-retention.js",
|
|
146
147
|
"./run-composition": "./dist/run-composition.js",
|
|
147
148
|
"./runtime-event-store": "./dist/runtime-event-store.js",
|
|
148
149
|
"./side-conversation": "./dist/side-conversation.js",
|
|
@@ -260,8 +260,13 @@ export class McpOAuthProvider {
|
|
|
260
260
|
record.pendingRedirectUrl ||
|
|
261
261
|
record.pendingServerUrl ||
|
|
262
262
|
record.pendingState;
|
|
263
|
-
|
|
264
|
-
|
|
263
|
+
// SDK credentials predating issuer binding cannot safely follow discovery.
|
|
264
|
+
// Revoke them instead of adopting whichever issuer the server names next.
|
|
265
|
+
const missingIssuer = (record.tokens !== undefined && !record.tokens.issuer) ||
|
|
266
|
+
(record.clientInformation !== undefined && !record.clientInformation.issuer);
|
|
267
|
+
return (missingIssuer ||
|
|
268
|
+
(Boolean(boundable) &&
|
|
269
|
+
!mcpOAuthRecordBoundTo(record, this.options.serverUrl, this.options.config)));
|
|
265
270
|
}
|
|
266
271
|
/** The same fail-closed binding rule as read(), applied to a mutation
|
|
267
272
|
* basis: a record bound elsewhere contributes NOTHING to the new write —
|
|
@@ -232,8 +232,17 @@ export function decodeConnectionOnboardingVerifyResult(value) {
|
|
|
232
232
|
return { kind: 'rejected', reason: rejected.reason };
|
|
233
233
|
}
|
|
234
234
|
export function decodeConnectionModelFetchInput(value) {
|
|
235
|
-
const
|
|
236
|
-
|
|
235
|
+
const record = requireRecord(value, 'connection model fetch input');
|
|
236
|
+
const input = requireExactRecord(value, 'connection model fetch input', [
|
|
237
|
+
'connectionId',
|
|
238
|
+
...(Object.hasOwn(record, 'preserveSelection') ? ['preserveSelection'] : []),
|
|
239
|
+
]);
|
|
240
|
+
return {
|
|
241
|
+
connectionId: requireEntityId(input.connectionId, 'connectionId'),
|
|
242
|
+
...(Object.hasOwn(input, 'preserveSelection')
|
|
243
|
+
? { preserveSelection: requireBoolean(input.preserveSelection, 'preserve model selection') }
|
|
244
|
+
: {}),
|
|
245
|
+
};
|
|
237
246
|
}
|
|
238
247
|
export function decodeConnectionTestRunInput(value) {
|
|
239
248
|
const input = requireExactRecord(value, 'connection test input', ['connectionId', 'modelId']);
|
|
@@ -65,7 +65,12 @@ export const RUNTIME_HOST_REGISTRATION_SCHEMA_VERSION = 1;
|
|
|
65
65
|
export const RUNTIME_HOST_PROTOCOL_VERSION = 0;
|
|
66
66
|
// Increment when the same protocol version no longer guarantees safe Client-Host
|
|
67
67
|
// interoperability. Mismatches are rejected before domain commands are admitted.
|
|
68
|
-
export const RUNTIME_HOST_COMPATIBILITY_EPOCH =
|
|
68
|
+
export const RUNTIME_HOST_COMPATIBILITY_EPOCH = 206;
|
|
69
|
+
// 206: `storage.retention.query` and `storage.retention.set` read and change the
|
|
70
|
+
// opt-in retention for archived tasks. An epoch-205 Client could not show or
|
|
71
|
+
// turn off a Host that deletes archived tasks on its own, and an epoch-205 Host
|
|
72
|
+
// rejects the unknown operations, so the pair must fail admission.
|
|
73
|
+
// 205: Default-model selection can enable atomically; discovery can preserve the model selection.
|
|
69
74
|
// 204: Executor catalogs and Session configuration carry opaque mode IDs;
|
|
70
75
|
// catalog queries may request a provider refresh. Older peers reject these fields.
|
|
71
76
|
// 202: `session.remove.preview` takes a bounded list of Sessions and reports the
|
|
@@ -58,6 +58,7 @@ import { SESSION_RETIREMENT_OPERATION_SPECS } from './session-retirement.js';
|
|
|
58
58
|
import { PROMPT_SUGGESTION_OPERATION_SPECS } from './prompt-suggestions.js';
|
|
59
59
|
import { SESSION_EFFECT_OPERATION_SPECS } from './session-effects.js';
|
|
60
60
|
import { SKILL_CATALOG_OPERATION_SPECS } from './skill-catalog.js';
|
|
61
|
+
import { STORAGE_RETENTION_OPERATION_SPECS } from './storage-retention.js';
|
|
61
62
|
import { STORAGE_USAGE_OPERATION_SPECS } from './storage-usage.js';
|
|
62
63
|
import { TURN_OPERATION_SPECS } from './turn.js';
|
|
63
64
|
import { USAGE_PRICING_OPERATION_SPECS } from './usage-pricing.js';
|
|
@@ -97,12 +98,13 @@ export * from './session-todo.js';
|
|
|
97
98
|
export * from './session-effects.js';
|
|
98
99
|
export * from './prompt-suggestions.js';
|
|
99
100
|
export * from './skill-catalog.js';
|
|
101
|
+
export * from './storage-retention.js';
|
|
100
102
|
export * from './storage-usage.js';
|
|
101
103
|
export * from './usage-pricing.js';
|
|
102
104
|
export * from './web-search.js';
|
|
103
105
|
export * from './recall.js';
|
|
104
106
|
export * from './workspace.js';
|
|
105
|
-
export const HOST_OPERATION_SPECS = composeOperationSpecMaps(HOST_BOOTSTRAP_OPERATION_SPECS, HOST_RESOURCE_OPERATION_SPECS, PEER_MESH_OPERATION_SPECS, HOSTED_EXECUTION_OPERATION_SPECS, ACCESS_AUTHORITY_OPERATION_SPECS, SESSION_COLLABORATION_OPERATION_SPECS, AGENT_GRAPH_OPERATION_SPECS, GOAL_OPERATION_SPECS, TURN_OPERATION_SPECS, CONTEXT_OPERATION_SPECS, CONNECTION_EFFECT_OPERATION_SPECS, DAILY_REVIEW_OPERATION_SPECS, EXECUTION_INSPECT_OPERATION_SPECS, EXTERNAL_SESSION_OPERATION_SPECS, RUNTIME_POLICY_OPERATION_SPECS, RUNTIME_RESOURCE_OPERATION_SPECS, SCHEDULED_TASK_OPERATION_SPECS, PLAN_OPERATION_SPECS, PROJECT_CATALOG_OPERATION_SPECS, MESSAGE_OPERATION_SPECS, SESSION_TODO_OPERATION_SPECS, INTERACTION_OPERATION_SPECS, SESSION_CONTINUITY_OPERATION_SPECS, SESSION_TRANSCRIPT_OPERATION_SPECS, SESSION_TURNS_OPERATION_SPECS, SESSION_CATALOG_OPERATION_SPECS, SESSION_EFFECT_OPERATION_SPECS, PROMPT_SUGGESTION_OPERATION_SPECS, SESSION_REVISION_OPERATION_SPECS, SESSION_BUNDLE_OPERATION_SPECS, SESSION_RETIREMENT_OPERATION_SPECS, ARTIFACT_OPERATION_SPECS, SKILL_CATALOG_OPERATION_SPECS, USAGE_PRICING_OPERATION_SPECS, STORAGE_USAGE_OPERATION_SPECS, MEMORY_OPERATION_SPECS, OAUTH_OPERATION_SPECS, EXTERNAL_AGENT_SETUP_OPERATION_SPECS, CLIENT_CAPABILITY_OPERATION_SPECS, WEB_SEARCH_OPERATION_SPECS, NETWORK_PROXY_OPERATION_SPECS, RECALL_OPERATION_SPECS, CONFIGURATION_OPERATION_SPECS, WORKHUB_COORDINATION_OPERATION_SPECS, PLUGIN_PLATFORM_OPERATION_SPECS);
|
|
107
|
+
export const HOST_OPERATION_SPECS = composeOperationSpecMaps(HOST_BOOTSTRAP_OPERATION_SPECS, HOST_RESOURCE_OPERATION_SPECS, PEER_MESH_OPERATION_SPECS, HOSTED_EXECUTION_OPERATION_SPECS, ACCESS_AUTHORITY_OPERATION_SPECS, SESSION_COLLABORATION_OPERATION_SPECS, AGENT_GRAPH_OPERATION_SPECS, GOAL_OPERATION_SPECS, TURN_OPERATION_SPECS, CONTEXT_OPERATION_SPECS, CONNECTION_EFFECT_OPERATION_SPECS, DAILY_REVIEW_OPERATION_SPECS, EXECUTION_INSPECT_OPERATION_SPECS, EXTERNAL_SESSION_OPERATION_SPECS, RUNTIME_POLICY_OPERATION_SPECS, RUNTIME_RESOURCE_OPERATION_SPECS, SCHEDULED_TASK_OPERATION_SPECS, PLAN_OPERATION_SPECS, PROJECT_CATALOG_OPERATION_SPECS, MESSAGE_OPERATION_SPECS, SESSION_TODO_OPERATION_SPECS, INTERACTION_OPERATION_SPECS, SESSION_CONTINUITY_OPERATION_SPECS, SESSION_TRANSCRIPT_OPERATION_SPECS, SESSION_TURNS_OPERATION_SPECS, SESSION_CATALOG_OPERATION_SPECS, SESSION_EFFECT_OPERATION_SPECS, PROMPT_SUGGESTION_OPERATION_SPECS, SESSION_REVISION_OPERATION_SPECS, SESSION_BUNDLE_OPERATION_SPECS, SESSION_RETIREMENT_OPERATION_SPECS, ARTIFACT_OPERATION_SPECS, SKILL_CATALOG_OPERATION_SPECS, USAGE_PRICING_OPERATION_SPECS, STORAGE_USAGE_OPERATION_SPECS, STORAGE_RETENTION_OPERATION_SPECS, MEMORY_OPERATION_SPECS, OAUTH_OPERATION_SPECS, EXTERNAL_AGENT_SETUP_OPERATION_SPECS, CLIENT_CAPABILITY_OPERATION_SPECS, WEB_SEARCH_OPERATION_SPECS, NETWORK_PROXY_OPERATION_SPECS, RECALL_OPERATION_SPECS, CONFIGURATION_OPERATION_SPECS, WORKHUB_COORDINATION_OPERATION_SPECS, PLUGIN_PLATFORM_OPERATION_SPECS);
|
|
106
108
|
// Remote credentials are fail-closed: adding a protocol operation does not
|
|
107
109
|
// grant it to remote owners until this policy is deliberately updated.
|
|
108
110
|
export const REMOTE_OWNER_OPERATION_GRANTS = Object.freeze([
|
|
@@ -213,6 +215,8 @@ export const REMOTE_OWNER_OPERATION_GRANTS = Object.freeze([
|
|
|
213
215
|
'skill.catalog.mutate',
|
|
214
216
|
'skill.catalog.preview-update',
|
|
215
217
|
'skill.catalog.query',
|
|
218
|
+
'storage.retention.query',
|
|
219
|
+
'storage.retention.set',
|
|
216
220
|
'storage.usage.query',
|
|
217
221
|
'storage.usage.sessions.query',
|
|
218
222
|
'subscription.close',
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
|
4
|
+
* distributed with this work for additional information
|
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
|
7
|
+
* "License"); you may not use this file except in compliance
|
|
8
|
+
* with the License. You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
|
13
|
+
* software distributed under the License is distributed on an
|
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
* KIND, either express or implied. See the License for the
|
|
16
|
+
* specific language governing permissions and limitations
|
|
17
|
+
* under the License.
|
|
18
|
+
*/
|
|
19
|
+
import { decodeArchiveRetentionDeletion, decodeArchiveRetentionHold, decodeArchiveRetentionSweep, isArchiveRetentionDays, } from '@maka/core/archive-retention';
|
|
20
|
+
import { requireCount, requireShapedRecord } from './codec.js';
|
|
21
|
+
import { invalidProtocolFrame } from './errors.js';
|
|
22
|
+
import { defineOperation } from './operation-spec.js';
|
|
23
|
+
const QUERY_ERRORS = [
|
|
24
|
+
'host_not_ready',
|
|
25
|
+
'host_draining',
|
|
26
|
+
'operation_unavailable',
|
|
27
|
+
'persistence_failed',
|
|
28
|
+
'internal_failure',
|
|
29
|
+
];
|
|
30
|
+
const SET_ERRORS = [...QUERY_ERRORS, 'commit_outcome_unknown'];
|
|
31
|
+
export const STORAGE_RETENTION_OPERATION_SPECS = {
|
|
32
|
+
'storage.retention.query': defineOperation({
|
|
33
|
+
mode: 'query',
|
|
34
|
+
availability: 'ready',
|
|
35
|
+
errors: QUERY_ERRORS,
|
|
36
|
+
decodeInput: decodeStorageRetentionQueryInput,
|
|
37
|
+
decodeOutput: decodeStorageRetentionQueryResult,
|
|
38
|
+
}),
|
|
39
|
+
'storage.retention.set': defineOperation({
|
|
40
|
+
mode: 'command',
|
|
41
|
+
availability: 'ready',
|
|
42
|
+
errors: SET_ERRORS,
|
|
43
|
+
decodeInput: decodeStorageRetentionSetInput,
|
|
44
|
+
decodeOutput: decodeStorageRetentionSetResult,
|
|
45
|
+
assertOutputForInput: (input, output) => {
|
|
46
|
+
if (output.kind === 'revision_conflict') {
|
|
47
|
+
if (output.expectedRevision !== input.expectedRevision) {
|
|
48
|
+
throw invalidProtocolFrame('Retention revision conflict does not match the request');
|
|
49
|
+
}
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (output.setting.enabled !== input.enabled ||
|
|
53
|
+
output.setting.days !== input.days ||
|
|
54
|
+
output.setting.revision < input.expectedRevision) {
|
|
55
|
+
throw invalidProtocolFrame('Retention setting does not match the request');
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
}),
|
|
59
|
+
};
|
|
60
|
+
export function decodeStorageRetentionQueryInput(value) {
|
|
61
|
+
requireShapedRecord(value, 'storage retention input', [], []);
|
|
62
|
+
return {};
|
|
63
|
+
}
|
|
64
|
+
export function decodeStorageRetentionQueryResult(value) {
|
|
65
|
+
const result = requireShapedRecord(value, 'storage retention result', ['revision', 'enabled', 'days', 'preview'], ['enabledAt', 'lastSweep', 'lastDeletion', 'hold']);
|
|
66
|
+
const setting = decodeSettingFields(result);
|
|
67
|
+
return {
|
|
68
|
+
...setting,
|
|
69
|
+
preview: decodePreview(result.preview, setting.enabled),
|
|
70
|
+
...(result.lastSweep === undefined
|
|
71
|
+
? {}
|
|
72
|
+
: { lastSweep: decodeArchiveRetentionSweep(result.lastSweep, invalidProtocolFrame) }),
|
|
73
|
+
...(result.lastDeletion === undefined
|
|
74
|
+
? {}
|
|
75
|
+
: {
|
|
76
|
+
lastDeletion: decodeArchiveRetentionDeletion(result.lastDeletion, invalidProtocolFrame),
|
|
77
|
+
}),
|
|
78
|
+
...(result.hold === undefined
|
|
79
|
+
? {}
|
|
80
|
+
: { hold: decodeArchiveRetentionHold(result.hold, invalidProtocolFrame) }),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export function decodeStorageRetentionSetInput(value) {
|
|
84
|
+
const input = requireShapedRecord(value, 'storage retention set input', ['expectedRevision', 'enabled', 'days'], []);
|
|
85
|
+
return {
|
|
86
|
+
expectedRevision: requireCount(input.expectedRevision, 'retention expectedRevision'),
|
|
87
|
+
enabled: requireBoolean(input.enabled, 'retention enabled'),
|
|
88
|
+
days: requireDays(input.days),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
export function decodeStorageRetentionSetResult(value) {
|
|
92
|
+
const result = requireShapedRecord(value, 'storage retention set result', ['kind'], ['setting', 'expectedRevision', 'actualRevision']);
|
|
93
|
+
if (result.kind === 'committed') {
|
|
94
|
+
requireShapedRecord(result, 'storage retention set result', ['kind', 'setting'], []);
|
|
95
|
+
const setting = requireShapedRecord(result.setting, 'storage retention setting', ['revision', 'enabled', 'days'], ['enabledAt']);
|
|
96
|
+
return { kind: 'committed', setting: decodeSettingFields(setting) };
|
|
97
|
+
}
|
|
98
|
+
if (result.kind === 'revision_conflict') {
|
|
99
|
+
requireShapedRecord(result, 'storage retention revision conflict', ['kind', 'expectedRevision', 'actualRevision'], []);
|
|
100
|
+
return {
|
|
101
|
+
kind: 'revision_conflict',
|
|
102
|
+
expectedRevision: requireCount(result.expectedRevision, 'retention expectedRevision'),
|
|
103
|
+
actualRevision: requireCount(result.actualRevision, 'retention actualRevision'),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
throw invalidProtocolFrame('Invalid storage retention set result');
|
|
107
|
+
}
|
|
108
|
+
function decodeSettingFields(record) {
|
|
109
|
+
const enabled = requireBoolean(record.enabled, 'retention enabled');
|
|
110
|
+
if (enabled !== (record.enabledAt !== undefined)) {
|
|
111
|
+
throw invalidProtocolFrame('Retention enabledAt must be present exactly while enabled');
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
revision: requireCount(record.revision, 'retention revision'),
|
|
115
|
+
enabled,
|
|
116
|
+
days: requireDays(record.days),
|
|
117
|
+
...(record.enabledAt === undefined
|
|
118
|
+
? {}
|
|
119
|
+
: { enabledAt: requireCount(record.enabledAt, 'retention enabledAt') }),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function decodePreview(value, enabled) {
|
|
123
|
+
const preview = requireShapedRecord(value, 'retention preview', ['count'], ['eligibleAt']);
|
|
124
|
+
const count = requireCount(preview.count, 'retention preview count');
|
|
125
|
+
if ((enabled && count > 0) !== (preview.eligibleAt !== undefined)) {
|
|
126
|
+
throw invalidProtocolFrame('Retention preview eligibleAt must be present exactly when due');
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
count,
|
|
130
|
+
...(preview.eligibleAt === undefined
|
|
131
|
+
? {}
|
|
132
|
+
: { eligibleAt: requireCount(preview.eligibleAt, 'retention preview eligibleAt') }),
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function requireDays(value) {
|
|
136
|
+
if (!isArchiveRetentionDays(value))
|
|
137
|
+
throw invalidProtocolFrame('Invalid retention days');
|
|
138
|
+
return value;
|
|
139
|
+
}
|
|
140
|
+
function requireBoolean(value, label) {
|
|
141
|
+
if (typeof value !== 'boolean')
|
|
142
|
+
throw invalidProtocolFrame(`Invalid ${label}`);
|
|
143
|
+
return value;
|
|
144
|
+
}
|