maka-agent 0.2.0-dev.11.20260831 → 0.2.0-dev.14.20260902
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 +2 -2
- package/RUNTIME_HOST_PEER_DEPENDENCIES.rust.tsv +70 -0
- package/RUNTIME_HOST_PEER_THIRD_PARTY_NOTICES.txt +1839 -140
- package/THIRD_PARTY_NOTICES.txt +2 -2
- package/dist/acp/maka-acp-agent.js +6 -3
- package/dist/acp/session-registry.js +307 -0
- package/dist/acp/stdio-server.js +20 -1
- package/dist/cli-core.js +40 -3
- package/dist/mcp-capability-provider.js +1 -1
- package/dist/onboarding-catalog.js +3 -5
- package/dist/pi-transcript.js +21 -17
- package/dist/pi-tui-layout.js +4 -2
- package/dist/pi-tui-mcp-status.js +44 -130
- package/dist/pi-tui-pickers.js +11 -5
- package/dist/pi-tui-runner.js +133 -102
- package/dist/runtime-host-access-command.js +37 -4
- package/dist/runtime-host-capability-provider-command.js +16 -2
- package/dist/runtime-host-cli-context.js +73 -3
- package/dist/runtime-host-cli.js +187 -10
- package/dist/runtime-host-lifecycle-transaction.js +5 -2
- package/dist/runtime-host-managed-lifecycle-manager.js +1 -0
- package/dist/runtime-host-onboarding.js +12 -16
- package/dist/runtime-host-peer-management-command.js +16 -4
- package/dist/runtime-host-plugin-command.js +101 -0
- package/dist/runtime-host-run-command.js +8 -2
- package/dist/runtime-host-service-management-command.js +2 -1
- package/dist/runtime-host-setup-command.js +1 -0
- package/dist/runtime-host-task-readiness.js +2 -3
- package/dist/runtime-host-tui-command.js +1 -1
- package/dist/runtime-host-tui-context.js +18 -5
- package/dist/runtime-host-update-command.js +71 -35
- package/dist/runtime-host-update-discovery.js +1 -0
- package/dist/tui-clipboard.js +86 -0
- package/dist/tui-copy-catalog.js +248 -0
- package/dist/tui-copy-command.js +103 -0
- package/native/runtime-host-peer/prebuilds/darwin-arm64/maka_runtime_host_peer.node +0 -0
- package/native/runtime-host-peer/prebuilds/linux-arm64/maka_runtime_host_peer.node +0 -0
- package/native/runtime-host-peer/prebuilds/linux-x64/maka_runtime_host_peer.node +0 -0
- package/native/runtime-host-peer/prebuilds/win32-x64/maka_runtime_host_peer.node +0 -0
- package/node_modules/@maka/core/dist/attachments.js +92 -1
- package/node_modules/@maka/core/dist/bounded-response.js +71 -0
- package/node_modules/@maka/core/dist/chat-model-choice.js +8 -33
- package/node_modules/@maka/core/dist/client-capability-grant.js +149 -0
- package/node_modules/@maka/core/dist/connection-error-copy.js +17 -34
- package/node_modules/@maka/core/dist/connection-readiness.js +3 -31
- package/node_modules/@maka/core/dist/deep-research.js +1 -20
- package/node_modules/@maka/core/dist/events.js +22 -14
- package/node_modules/@maka/core/dist/foreign-session.js +2 -2
- package/node_modules/@maka/core/dist/interaction.js +49 -2
- package/node_modules/@maka/core/dist/llm-connections.js +74 -82
- package/node_modules/@maka/core/dist/maka-wordmark.js +23 -0
- package/node_modules/@maka/core/dist/model-catalog.js +242 -315
- package/node_modules/@maka/core/dist/model-facts.js +13 -19
- package/node_modules/@maka/core/dist/model-metadata.generated.js +1907 -1872
- package/node_modules/@maka/core/dist/model-metadata.js +184 -199
- package/node_modules/@maka/core/dist/model-thinking.js +1 -1
- package/node_modules/@maka/core/dist/models-dev-projection.js +302 -0
- package/node_modules/@maka/core/dist/models-dev-refresh.js +55 -0
- package/node_modules/@maka/core/dist/onboarding.js +2 -1
- package/node_modules/@maka/core/dist/provider-auth.js +47 -291
- package/node_modules/@maka/core/dist/provider-registry.js +68 -357
- package/node_modules/@maka/core/dist/runtime-event.js +5 -0
- package/node_modules/@maka/core/dist/runtime-policy/connection-catalog-codec.js +83 -18
- package/node_modules/@maka/core/dist/runtime-policy/credential-vault-codec.js +9 -1
- package/node_modules/@maka/core/dist/runtime-policy/model-catalog-entry-codec.js +84 -0
- package/node_modules/@maka/core/dist/runtime-policy/policy-codec.js +75 -0
- package/node_modules/@maka/core/dist/runtime-policy.js +5 -2
- package/node_modules/@maka/core/dist/session-send-projection.js +2 -1
- package/node_modules/@maka/core/dist/session-start-mode.js +42 -0
- package/node_modules/@maka/core/dist/session.js +120 -5
- package/node_modules/@maka/core/dist/settings.js +10 -2
- package/node_modules/@maka/core/dist/slash-command-catalog.js +1 -0
- package/node_modules/@maka/core/dist/task-submission-readiness.js +2 -1
- package/node_modules/@maka/core/dist/usage-record-schema.js +11 -1
- package/node_modules/@maka/core/dist/workhub-creation-intent.js +896 -0
- package/node_modules/@maka/core/package.json +8 -2
- package/node_modules/@maka/mcp/dist/index.js +1 -0
- package/node_modules/@maka/runtime/dist/agent-run.js +7 -0
- package/node_modules/@maka/runtime/dist/ai-sdk-backend.js +55 -82
- package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +178 -140
- package/node_modules/@maka/runtime/dist/archive-read-tool.js +26 -5
- package/node_modules/@maka/runtime/dist/builtin-tools.js +27 -2
- package/node_modules/@maka/runtime/dist/context-budget-policy.js +0 -12
- package/node_modules/@maka/runtime/dist/conversation-copy.js +66 -43
- package/node_modules/@maka/runtime/dist/durable-tool-result-projection.js +31 -0
- package/node_modules/@maka/runtime/dist/history-compact-error.js +10 -2
- package/node_modules/@maka/runtime/dist/history-compact-input-fit.js +7 -1
- package/node_modules/@maka/runtime/dist/history-compaction.js +13 -22
- package/node_modules/@maka/runtime/dist/image-file.js +5 -20
- package/node_modules/@maka/runtime/dist/local-web-fetch.js +2 -43
- package/node_modules/@maka/runtime/dist/mcp-tools.js +28 -0
- package/node_modules/@maka/runtime/dist/model-fetcher.js +15 -8
- package/node_modules/@maka/runtime/dist/model-history.js +59 -17
- package/node_modules/@maka/runtime/dist/model-runtime.js +2 -2
- package/node_modules/@maka/runtime/dist/plugin-composition-loader.js +173 -20
- package/node_modules/@maka/runtime/dist/plugin-runtime.js +219 -0
- package/node_modules/@maka/runtime/dist/provider-image-overflow-recovery.js +12 -31
- package/node_modules/@maka/runtime/dist/quiescent-session-snapshot.js +78 -0
- package/node_modules/@maka/runtime/dist/runtime-event-backfill.js +6 -0
- package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +14 -2
- package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +11 -10
- package/node_modules/@maka/runtime/dist/shell-tools.js +77 -1
- package/node_modules/@maka/runtime/dist/telemetry/model-pricing.generated.js +93 -83
- package/node_modules/@maka/runtime/dist/test-connection.js +6 -6
- package/node_modules/@maka/runtime/dist/tool-availability.js +74 -5
- package/node_modules/@maka/runtime/dist/tool-result-archive-resource.js +333 -52
- package/node_modules/@maka/runtime/dist/tool-result-archive-transition.js +34 -3
- package/node_modules/@maka/runtime/dist/tool-runtime.js +62 -6
- package/node_modules/@maka/runtime/dist/workers/filesystem-worker.js +39 -16
- package/node_modules/@maka/runtime/package.json +1 -0
- package/node_modules/@maka/runtime-host/dist/adapter/session-projector.js +10 -3
- package/node_modules/@maka/runtime-host/dist/client/catalog-reader.js +59 -18
- package/node_modules/@maka/runtime-host/dist/client/client-capability-channel.js +3 -2
- package/node_modules/@maka/runtime-host/dist/client/connection.js +72 -31
- package/node_modules/@maka/runtime-host/dist/client/host-profile.js +49 -4
- package/node_modules/@maka/runtime-host/dist/client/index.js +3 -2
- package/node_modules/@maka/runtime-host/dist/client/oauth-presentation.js +1 -1
- package/node_modules/@maka/runtime-host/dist/client/owner-connection-code.js +32 -1
- package/node_modules/@maka/runtime-host/dist/client/peer-client.js +26 -4
- package/node_modules/@maka/runtime-host/dist/client/reconnecting-connection.js +8 -0
- package/node_modules/@maka/runtime-host/dist/operator/access-management-frame.js +10 -1
- package/node_modules/@maka/runtime-host/dist/operator/index.js +2 -1
- package/node_modules/@maka/runtime-host/dist/operator/managed-deployment.js +2 -0
- package/node_modules/@maka/runtime-host/dist/operator/peer-management-frame.js +2 -0
- package/node_modules/@maka/runtime-host/dist/operator/service-management-frame.js +2 -0
- package/node_modules/@maka/runtime-host/dist/peer-mesh/node.js +56 -12
- package/node_modules/@maka/runtime-host/dist/peer-mesh/owner.js +4 -0
- package/node_modules/@maka/runtime-host/dist/protocol/client-capability.js +22 -1
- package/node_modules/@maka/runtime-host/dist/protocol/configuration.js +55 -9
- package/node_modules/@maka/{storage/dist/task-ledger-store-internal.js → runtime-host/dist/protocol/connection-catalog-change.js} +7 -13
- package/node_modules/@maka/runtime-host/dist/protocol/host-status.js +37 -0
- package/node_modules/@maka/runtime-host/dist/protocol/index.js +49 -1
- package/node_modules/@maka/runtime-host/dist/protocol/network-proxy.js +1 -7
- package/node_modules/@maka/runtime-host/dist/protocol/operations.js +5 -1
- package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +512 -0
- package/node_modules/@maka/runtime-host/dist/protocol/runtime-policy.js +72 -61
- package/node_modules/@maka/runtime-host/dist/protocol/session-catalog.js +1 -1
- package/node_modules/@maka/runtime-host/dist/protocol/session-collaboration.js +4 -2
- package/node_modules/@maka/runtime-host/dist/protocol/turn.js +5 -12
- package/node_modules/@maka/runtime-host/dist/protocol/workhub-coordination.js +92 -4
- package/node_modules/@maka/runtime-host/dist/server/access-authority.js +17 -14
- package/node_modules/@maka/runtime-host/dist/server/access-credential-metadata.js +4 -2
- package/node_modules/@maka/runtime-host/dist/server/access-credential-store.js +119 -47
- package/node_modules/@maka/runtime-host/dist/server/agent-graph-execution-coordinator.js +1 -2
- package/node_modules/@maka/runtime-host/dist/server/bootstrap-runtime-policy.js +10 -4
- package/node_modules/@maka/runtime-host/dist/server/canonical-turn-snapshot.js +0 -9
- package/node_modules/@maka/runtime-host/dist/server/client-capability-coordinator.js +192 -18
- package/node_modules/@maka/runtime-host/dist/server/client-capability-invocation-broker.js +122 -48
- package/node_modules/@maka/runtime-host/dist/server/client-capability-provider-id.js +31 -0
- package/node_modules/@maka/runtime-host/dist/server/configuration-coordinator.js +20 -1
- package/node_modules/@maka/runtime-host/dist/server/connection-effect-coordinator.js +5 -5
- package/node_modules/@maka/runtime-host/dist/server/connection-session.js +1 -0
- package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +163 -28
- package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +2 -2
- package/node_modules/@maka/runtime-host/dist/server/execution-service.js +4 -1
- package/node_modules/@maka/runtime-host/dist/server/extension-bundle.js +249 -0
- package/node_modules/@maka/runtime-host/dist/server/extension-package-manifest.js +262 -0
- package/node_modules/@maka/runtime-host/dist/server/host-change-feed.js +11 -0
- package/node_modules/@maka/runtime-host/dist/server/host-kernel.js +15 -0
- package/node_modules/@maka/runtime-host/dist/server/index.js +5 -0
- package/node_modules/@maka/runtime-host/dist/server/interaction-coordinator.js +181 -13
- package/node_modules/@maka/runtime-host/dist/server/interaction-projection.js +6 -0
- package/node_modules/@maka/runtime-host/dist/server/listener-set.js +8 -4
- package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +88 -22
- package/node_modules/@maka/runtime-host/dist/server/model-metadata-refresh.js +96 -0
- package/node_modules/@maka/runtime-host/dist/server/network-proxy-coordinator.js +0 -1
- package/node_modules/@maka/runtime-host/dist/server/operation-dispatcher.js +43 -118
- package/node_modules/@maka/runtime-host/dist/server/peer-listener.js +3 -0
- package/node_modules/@maka/runtime-host/dist/server/plugin-composition-patch.js +58 -0
- package/node_modules/@maka/runtime-host/dist/server/plugin-composition-store.js +141 -0
- package/node_modules/@maka/runtime-host/dist/server/plugin-package-loader.js +130 -0
- package/node_modules/@maka/runtime-host/dist/server/plugin-package-store.js +528 -0
- package/node_modules/@maka/runtime-host/dist/server/plugin-platform-coordinator.js +249 -0
- package/node_modules/@maka/runtime-host/dist/server/plugin-platform.js +1130 -0
- package/node_modules/@maka/runtime-host/dist/server/root-admission-owner.js +4 -0
- package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +24 -5
- package/node_modules/@maka/runtime-host/dist/server/runtime-policy-coordinator.js +57 -5
- package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +2 -1
- package/node_modules/@maka/runtime-host/dist/server/session-retirement-coordinator.js +3 -3
- package/node_modules/@maka/runtime-host/dist/server/session-revision-coordinator.js +35 -3
- package/node_modules/@maka/runtime-host/dist/server/session-sidecar-purge.js +16 -0
- package/node_modules/@maka/runtime-host/dist/server/session-transcript-pager.js +10 -2
- package/node_modules/@maka/runtime-host/dist/server/web-fetch-tool.js +1 -1
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-action-gate.js +276 -3
- package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +101 -1
- package/node_modules/@maka/runtime-host/dist/transport/peer-native.js +1 -0
- package/node_modules/@maka/runtime-host/dist/webrtc-stun-policy.js +114 -0
- package/node_modules/@maka/runtime-host/package.json +2 -0
- package/node_modules/@maka/storage/dist/agent-run-store.js +4 -0
- package/node_modules/@maka/storage/dist/artifact-store.js +7 -23
- package/node_modules/@maka/storage/dist/conversation-operational-state.js +3 -0
- package/node_modules/@maka/storage/dist/execution-stores.js +3 -0
- package/node_modules/@maka/storage/dist/interaction-store-public.js +1 -1
- package/node_modules/@maka/storage/dist/interaction-store.js +173 -0
- package/node_modules/@maka/storage/dist/production-session-snapshot.js +761 -0
- package/node_modules/@maka/storage/dist/quiescent-session-snapshot.js +1 -1
- package/node_modules/@maka/storage/dist/runtime-policy/connection-catalog-document.js +19 -22
- package/node_modules/@maka/storage/dist/runtime-policy/coordinator.js +205 -42
- package/node_modules/@maka/storage/dist/runtime-policy/onboarding-transaction.js +2 -2
- package/node_modules/@maka/storage/dist/runtime-policy-stores.js +5 -2
- package/node_modules/@maka/storage/dist/session-message-projection.js +1 -1
- package/node_modules/@maka/storage/dist/session-store.js +32 -6
- package/node_modules/@maka/storage/dist/session-todo-store.js +6 -68
- package/node_modules/@maka/storage/dist/settings-store.js +16 -25
- package/node_modules/@maka/storage/dist/sqlite-core-execution-schema.js +19 -0
- package/node_modules/@maka/storage/dist/sqlite-session-metadata-schema.js +10 -1
- package/node_modules/@maka/storage/dist/sqlite-session-metadata-store.js +73 -3
- package/node_modules/@maka/storage/dist/sqlite-workflow-schema.js +2 -10
- package/node_modules/@maka/storage/package.json +2 -0
- package/node_modules/fast-uri/index.js +215 -47
- package/node_modules/fast-uri/lib/schemes.js +9 -4
- package/node_modules/fast-uri/lib/utils.js +396 -92
- package/node_modules/fast-uri/package.json +1 -1
- package/node_modules/qs/.github/THREAT_MODEL.md +3 -3
- package/node_modules/qs/CHANGELOG.md +15 -0
- package/node_modules/qs/README.md +19 -1
- package/node_modules/qs/dist/qs.js +21 -21
- package/node_modules/qs/eslint.config.mjs +1 -1
- package/node_modules/qs/lib/parse.js +3 -4
- package/node_modules/qs/lib/stringify.js +23 -8
- package/node_modules/qs/lib/utils.js +10 -3
- package/node_modules/qs/package.json +4 -4
- package/package.json +1 -1
- package/node_modules/@maka/core/dist/task-ledger.js +0 -669
- package/node_modules/@maka/storage/dist/task-ledger-authority.js +0 -121
- package/node_modules/@maka/storage/dist/task-ledger-store.js +0 -663
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* specific language governing permissions and limitations
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
|
-
import { CONNECTION_CATALOG_MAX_CONNECTIONS, CONNECTION_CATALOG_MAX_ENABLED_MODEL_IDS, CONNECTION_CATALOG_MAX_MODELS_PER_CONNECTION, decodeCanonicalConnectionBaseUrl, decodeCanonicalRuntimePolicy, decodeConnectionModel, decodeConnectionModelId, decodeConnectionName, decodeConnectionSlug, decodeConnectionTarget, decodeConnectionTestSummary, decodeConnectionVersionBasis, decodeRuntimePolicyEntityId, decodeCredentialLocator, decodeCredentialStatus, decodeCredentialVersionBasis, decodeProviderType, normalizeCreateCatalogConnectionInput, normalizeDeleteCredentialInput, normalizeRemoveCatalogConnectionInput, normalizeOptionalRequestBodyOverlay, normalizeRequestHeaderUpdates, normalizeRuntimePolicyMutation, normalizeSetCredentialInput, normalizeSetDefaultConnectionTargetInput, normalizeUpdateCatalogConnectionInput, REQUEST_HEADERS_MAX_BYTES, RequestCustomizationValidationError, RuntimePolicyDomainDecodeError, } from '@maka/core/runtime-policy';
|
|
19
|
+
import { CONNECTION_CATALOG_MAX_CONNECTIONS, CONNECTION_CATALOG_MAX_ENABLED_MODEL_IDS, CONNECTION_CATALOG_MAX_ENTRIES_PER_CONNECTION, CONNECTION_CATALOG_MAX_MODELS_PER_CONNECTION, decodeCanonicalConnectionBaseUrl, decodeModelCatalogEntry, decodeCanonicalRuntimePolicy, decodeConnectionModel, decodeConnectionModelId, decodeConnectionName, decodeConnectionSlug, decodeConnectionTarget, decodeConnectionTestSummary, decodeConnectionVersionBasis, decodeRuntimePolicyEntityId, decodeCredentialLocator, decodeCredentialStatus, decodeCredentialVersionBasis, decodeProviderType, normalizeCreateCatalogConnectionInput, normalizeDeleteCredentialInput, normalizeRemoveCatalogConnectionInput, normalizeOptionalRequestBodyOverlay, normalizeNetworkProxyUpdate, normalizeNetworkProxyCredentialTarget, normalizeRequestHeaderUpdates, normalizeRuntimePolicyMutation, normalizeSetCredentialInput, normalizeSetDefaultConnectionTargetInput, normalizeUpdateCatalogConnectionInput, REQUEST_HEADERS_MAX_BYTES, RequestCustomizationValidationError, RuntimePolicyDomainDecodeError, } from '@maka/core/runtime-policy';
|
|
20
20
|
import { normalizeRelayModelProfiles } from '@maka/core/model-thinking';
|
|
21
21
|
import { requireExactRecord, requireShapedRecord, requireRecord } from './codec.js';
|
|
22
22
|
import { invalidProtocolFrame } from './errors.js';
|
|
@@ -25,33 +25,6 @@ export const CONNECTION_CATALOG_PAGE_MAX_ITEMS = 128;
|
|
|
25
25
|
export const CONNECTION_CATALOG_PAGE_MAX_BYTES = 48 * 1024;
|
|
26
26
|
export const RUNTIME_POLICY_SNAPSHOT_MAX_BYTES = 48 * 1024;
|
|
27
27
|
export const CREDENTIAL_SECRET_MAX_BYTES = 10 * 1024;
|
|
28
|
-
const CONNECTION_MODEL_FIELDS = [
|
|
29
|
-
'id',
|
|
30
|
-
'displayName',
|
|
31
|
-
'description',
|
|
32
|
-
'apiProtocol',
|
|
33
|
-
'contextWindow',
|
|
34
|
-
'inputLimit',
|
|
35
|
-
'maxOutputTokens',
|
|
36
|
-
'knowledgeCutoff',
|
|
37
|
-
'structuredOutput',
|
|
38
|
-
'lastUpdated',
|
|
39
|
-
'capabilities',
|
|
40
|
-
'modalities',
|
|
41
|
-
];
|
|
42
|
-
const MODEL_FACT_OVERRIDE_FIELDS = [
|
|
43
|
-
'displayName',
|
|
44
|
-
'description',
|
|
45
|
-
'apiProtocol',
|
|
46
|
-
'contextWindow',
|
|
47
|
-
'inputLimit',
|
|
48
|
-
'maxOutputTokens',
|
|
49
|
-
'knowledgeCutoff',
|
|
50
|
-
'structuredOutput',
|
|
51
|
-
'lastUpdated',
|
|
52
|
-
'capabilities',
|
|
53
|
-
'modalities',
|
|
54
|
-
];
|
|
55
28
|
const QUERY_ERRORS = [
|
|
56
29
|
'host_not_ready',
|
|
57
30
|
'host_draining',
|
|
@@ -85,6 +58,13 @@ export const RUNTIME_POLICY_OPERATION_SPECS = {
|
|
|
85
58
|
decodeInput: decodeRuntimePolicyMutation,
|
|
86
59
|
decodeOutput: decodeRuntimePolicyMutationResult,
|
|
87
60
|
}),
|
|
61
|
+
'runtime.policy.network-proxy.update': defineOperation({
|
|
62
|
+
mode: 'command',
|
|
63
|
+
availability: 'ready',
|
|
64
|
+
errors: MUTATION_ERRORS,
|
|
65
|
+
decodeInput: decodeRuntimePolicyNetworkProxyUpdate,
|
|
66
|
+
decodeOutput: decodeRuntimePolicyNetworkProxyUpdateResult,
|
|
67
|
+
}),
|
|
88
68
|
'connection.catalog.query': defineOperation({
|
|
89
69
|
mode: 'query',
|
|
90
70
|
availability: 'ready',
|
|
@@ -185,6 +165,44 @@ function decodeRuntimePolicyMutationResult(value) {
|
|
|
185
165
|
}
|
|
186
166
|
return revisionConflict(item, 'runtime policy mutation result');
|
|
187
167
|
}
|
|
168
|
+
function decodeRuntimePolicyNetworkProxyUpdate(value) {
|
|
169
|
+
const input = decodeDomain(() => normalizeNetworkProxyUpdate(value));
|
|
170
|
+
if (input.credential.kind === 'replace' &&
|
|
171
|
+
Buffer.byteLength(input.credential.secret, 'utf8') > CREDENTIAL_SECRET_MAX_BYTES) {
|
|
172
|
+
throw invalidProtocolFrame('Invalid network proxy credential secret');
|
|
173
|
+
}
|
|
174
|
+
return input;
|
|
175
|
+
}
|
|
176
|
+
function decodeRuntimePolicyNetworkProxyUpdateResult(value) {
|
|
177
|
+
const item = requireRecord(value, 'network proxy update result');
|
|
178
|
+
if (item.kind === 'committed') {
|
|
179
|
+
const committed = requireExactRecord(item, 'network proxy update committed result', [
|
|
180
|
+
'kind',
|
|
181
|
+
'revision',
|
|
182
|
+
'credentialStatus',
|
|
183
|
+
]);
|
|
184
|
+
return {
|
|
185
|
+
kind: 'committed',
|
|
186
|
+
revision: revision(committed.revision, 'runtime policy revision'),
|
|
187
|
+
credentialStatus: decodeDomain(() => decodeCredentialStatus(committed.credentialStatus)),
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
if (item.kind === 'credential_stale')
|
|
191
|
+
return credentialStale(item);
|
|
192
|
+
if (item.kind === 'proxy_target_mismatch') {
|
|
193
|
+
const mismatch = requireExactRecord(item, 'network proxy target mismatch', [
|
|
194
|
+
'kind',
|
|
195
|
+
'expected',
|
|
196
|
+
'actual',
|
|
197
|
+
]);
|
|
198
|
+
return {
|
|
199
|
+
kind: 'proxy_target_mismatch',
|
|
200
|
+
expected: decodeDomain(() => normalizeNetworkProxyCredentialTarget(mismatch.expected)),
|
|
201
|
+
actual: decodeDomain(() => normalizeNetworkProxyCredentialTarget(mismatch.actual)),
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
return revisionConflict(item, 'network proxy update result');
|
|
205
|
+
}
|
|
188
206
|
function decodeCatalogQueryInput(value) {
|
|
189
207
|
const item = requireRecord(value, 'connection catalog query input');
|
|
190
208
|
if (item.kind === 'start') {
|
|
@@ -260,7 +278,7 @@ function catalogCursor(value) {
|
|
|
260
278
|
part: 'connection',
|
|
261
279
|
};
|
|
262
280
|
}
|
|
263
|
-
if (item.part === 'enabled_model_id' || item.part === 'model') {
|
|
281
|
+
if (item.part === 'enabled_model_id' || item.part === 'model' || item.part === 'catalog_entry') {
|
|
264
282
|
const cursor = requireExactRecord(item, 'connection catalog cursor', [
|
|
265
283
|
'connectionIndex',
|
|
266
284
|
'part',
|
|
@@ -268,7 +286,9 @@ function catalogCursor(value) {
|
|
|
268
286
|
]);
|
|
269
287
|
const maxItems = item.part === 'enabled_model_id'
|
|
270
288
|
? CONNECTION_CATALOG_MAX_ENABLED_MODEL_IDS
|
|
271
|
-
:
|
|
289
|
+
: item.part === 'model'
|
|
290
|
+
? CONNECTION_CATALOG_MAX_MODELS_PER_CONNECTION
|
|
291
|
+
: CONNECTION_CATALOG_MAX_ENTRIES_PER_CONNECTION;
|
|
272
292
|
return {
|
|
273
293
|
connectionIndex: integer(cursor.connectionIndex, 'connection index', 0, CONNECTION_CATALOG_MAX_CONNECTIONS - 1),
|
|
274
294
|
part: item.part,
|
|
@@ -315,7 +335,21 @@ function catalogPageItem(value) {
|
|
|
315
335
|
kind: 'model',
|
|
316
336
|
connectionIndex: integer(modelItem.connectionIndex, 'connection index', 0, CONNECTION_CATALOG_MAX_CONNECTIONS - 1),
|
|
317
337
|
itemIndex: integer(modelItem.itemIndex, 'item index', 0, CONNECTION_CATALOG_MAX_MODELS_PER_CONNECTION - 1),
|
|
318
|
-
model:
|
|
338
|
+
model: decodeDomain(() => decodeConnectionModel(modelItem.model)),
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
if (item.kind === 'catalog_entry') {
|
|
342
|
+
const entryItem = requireExactRecord(item, 'connection catalog entry item', [
|
|
343
|
+
'kind',
|
|
344
|
+
'connectionIndex',
|
|
345
|
+
'itemIndex',
|
|
346
|
+
'entry',
|
|
347
|
+
]);
|
|
348
|
+
return {
|
|
349
|
+
kind: 'catalog_entry',
|
|
350
|
+
connectionIndex: integer(entryItem.connectionIndex, 'connection index', 0, CONNECTION_CATALOG_MAX_CONNECTIONS - 1),
|
|
351
|
+
itemIndex: integer(entryItem.itemIndex, 'item index', 0, CONNECTION_CATALOG_MAX_ENTRIES_PER_CONNECTION - 1),
|
|
352
|
+
entry: decodeDomain(() => decodeModelCatalogEntry(entryItem.entry)),
|
|
319
353
|
};
|
|
320
354
|
}
|
|
321
355
|
if (item.kind !== 'connection')
|
|
@@ -331,11 +365,11 @@ function catalogPageItem(value) {
|
|
|
331
365
|
'baseUrl',
|
|
332
366
|
'enabled',
|
|
333
367
|
'modelSource',
|
|
334
|
-
'modelsFetchedAt',
|
|
335
368
|
'lastTest',
|
|
336
369
|
'requestBodyOverlay',
|
|
337
370
|
'enabledModelIdCount',
|
|
338
371
|
'modelCount',
|
|
372
|
+
'catalogEntryCount',
|
|
339
373
|
], [
|
|
340
374
|
'kind',
|
|
341
375
|
'connectionIndex',
|
|
@@ -347,10 +381,8 @@ function catalogPageItem(value) {
|
|
|
347
381
|
'enabled',
|
|
348
382
|
'enabledModelIdCount',
|
|
349
383
|
'modelCount',
|
|
384
|
+
'catalogEntryCount',
|
|
350
385
|
]);
|
|
351
|
-
if ((header.modelSource === undefined) !== (header.modelsFetchedAt === undefined)) {
|
|
352
|
-
throw invalidProtocolFrame('Invalid connection header model discovery fields');
|
|
353
|
-
}
|
|
354
386
|
const provider = decodeDomain(() => decodeProviderType(header.providerType));
|
|
355
387
|
const baseUrl = header.baseUrl === undefined
|
|
356
388
|
? undefined
|
|
@@ -377,40 +409,15 @@ function catalogPageItem(value) {
|
|
|
377
409
|
...(baseUrl === undefined ? {} : { baseUrl }),
|
|
378
410
|
enabled: boolean(header.enabled, 'connection enabled'),
|
|
379
411
|
...(header.modelSource === undefined ? {} : { modelSource: modelSource(header.modelSource) }),
|
|
380
|
-
...(header.modelsFetchedAt === undefined
|
|
381
|
-
? {}
|
|
382
|
-
: {
|
|
383
|
-
modelsFetchedAt: integer(header.modelsFetchedAt, 'models fetched at', 0, Number.MAX_SAFE_INTEGER),
|
|
384
|
-
}),
|
|
385
412
|
...(header.lastTest === undefined
|
|
386
413
|
? {}
|
|
387
414
|
: { lastTest: decodeDomain(() => decodeConnectionTestSummary(header.lastTest)) }),
|
|
388
415
|
...(requestBodyOverlay === undefined ? {} : { requestBodyOverlay }),
|
|
389
416
|
enabledModelIdCount: integer(header.enabledModelIdCount, 'enabled model id count', 0, CONNECTION_CATALOG_MAX_ENABLED_MODEL_IDS),
|
|
390
417
|
modelCount,
|
|
418
|
+
catalogEntryCount: integer(header.catalogEntryCount, 'catalog entry count', 0, CONNECTION_CATALOG_MAX_ENTRIES_PER_CONNECTION),
|
|
391
419
|
};
|
|
392
420
|
}
|
|
393
|
-
/** Decode catalog-only read-time provenance without admitting it to persisted models. */
|
|
394
|
-
function decodeProjectedCatalogModel(value) {
|
|
395
|
-
const item = requireShapedRecord(value, 'projected connection model', ['id'], [...CONNECTION_MODEL_FIELDS.slice(1), 'factOverriddenFields']);
|
|
396
|
-
const { factOverriddenFields: rawOverriddenFields, ...persistentModel } = item;
|
|
397
|
-
const model = decodeDomain(() => decodeConnectionModel(persistentModel));
|
|
398
|
-
if (rawOverriddenFields === undefined)
|
|
399
|
-
return model;
|
|
400
|
-
if (!Array.isArray(rawOverriddenFields) || rawOverriddenFields.length === 0) {
|
|
401
|
-
throw invalidProtocolFrame('Invalid model fact overridden fields');
|
|
402
|
-
}
|
|
403
|
-
const factOverriddenFields = rawOverriddenFields.map((field) => {
|
|
404
|
-
if (!MODEL_FACT_OVERRIDE_FIELDS.includes(field)) {
|
|
405
|
-
throw invalidProtocolFrame('Invalid model fact overridden field');
|
|
406
|
-
}
|
|
407
|
-
return field;
|
|
408
|
-
});
|
|
409
|
-
if (new Set(factOverriddenFields).size !== factOverriddenFields.length) {
|
|
410
|
-
throw invalidProtocolFrame('Duplicate model fact overridden field');
|
|
411
|
-
}
|
|
412
|
-
return { ...model, factOverriddenFields };
|
|
413
|
-
}
|
|
414
421
|
function decodeCreateConnectionInput(value) {
|
|
415
422
|
const input = decodeDomain(() => normalizeCreateCatalogConnectionInput(value));
|
|
416
423
|
assertMutationEnabledModelIds(input.connection.enabledModelIds);
|
|
@@ -535,6 +542,8 @@ function decodeSetCredentialResult(value) {
|
|
|
535
542
|
requireExactRecord(item, 'credential connection not found result', ['kind']);
|
|
536
543
|
return { kind: 'connection_not_found' };
|
|
537
544
|
}
|
|
545
|
+
if (item.kind === 'connection_stale')
|
|
546
|
+
return connectionStale(item);
|
|
538
547
|
return credentialStale(item);
|
|
539
548
|
}
|
|
540
549
|
function decodeDeleteCredentialResult(value) {
|
|
@@ -664,6 +673,8 @@ function catalogCursorPartOrder(part) {
|
|
|
664
673
|
return 1;
|
|
665
674
|
case 'model':
|
|
666
675
|
return 2;
|
|
676
|
+
case 'catalog_entry':
|
|
677
|
+
return 3;
|
|
667
678
|
}
|
|
668
679
|
}
|
|
669
680
|
function credentialCommitted(value) {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
import { isCollaborationMode } from '@maka/core/collaboration';
|
|
20
20
|
import { isOrchestrationMode } from '@maka/core/orchestration';
|
|
21
21
|
import { isPermissionMode } from '@maka/core/permission';
|
|
22
|
-
import { isSessionStartMode } from '@maka/core/
|
|
22
|
+
import { isSessionStartMode } from '@maka/core/session-start-mode';
|
|
23
23
|
import { isSessionBlockedReason, isSessionToolProfile, } from '@maka/core/session';
|
|
24
24
|
import { isThinkingLevel } from '@maka/core/model-thinking';
|
|
25
25
|
import { assertAllowedKeys, requireCount, requireEncodedByteLimit, requireEntityId, requireExactRecord, requireRecord, requireShapedRecord, requireUtf8String, } from './codec.js';
|
|
@@ -212,8 +212,10 @@ function decodeCollaborationTurnRequestCreateInput(value) {
|
|
|
212
212
|
return { intent: decodeSessionTurnRequestIntent(record.intent) };
|
|
213
213
|
}
|
|
214
214
|
function decodeCollaborationTurnRequestQueryInput(value) {
|
|
215
|
-
const record =
|
|
216
|
-
return
|
|
215
|
+
const record = requireShapedRecord(value, 'collaboration Turn request query', [], ['sessionId']);
|
|
216
|
+
return record.sessionId === undefined
|
|
217
|
+
? {}
|
|
218
|
+
: { sessionId: requireEntityId(record.sessionId, 'sessionId') };
|
|
217
219
|
}
|
|
218
220
|
function decodeCollaborationTurnRequestQueryResult(value) {
|
|
219
221
|
const record = requireExactRecord(value, 'collaboration Turn request query result', [
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
import { MAX_ATTACHMENT_BYTES, MAX_ATTACHMENT_COUNT } from '@maka/core/attachments';
|
|
20
|
-
import { decodeMessageContent as decodeCanonicalMessageContent,
|
|
20
|
+
import { decodeMessageContent as decodeCanonicalMessageContent, DIRECTORY_REFERENCE_MAX_COUNT, isCanonicalAttachmentRef, } from '@maka/core/events';
|
|
21
21
|
import { isOrchestrationMode, isTurnOrchestrationSource, } from '@maka/core/orchestration';
|
|
22
22
|
import { decodeSkillInvocationResult, } from '@maka/core/skill-invocation';
|
|
23
23
|
import { invalidProtocolFrame } from './errors.js';
|
|
@@ -226,6 +226,9 @@ export function decodeMessageContent(value, allowEmptyText = false) {
|
|
|
226
226
|
if (content.displayText !== undefined) {
|
|
227
227
|
requireUtf8String(content.displayText, 'Message displayText', TURN_MESSAGE_TEXT_MAX_BYTES, true);
|
|
228
228
|
}
|
|
229
|
+
if ((content.directoryReferences?.length ?? 0) > DIRECTORY_REFERENCE_MAX_COUNT) {
|
|
230
|
+
throw invalidProtocolFrame('Too many directory references');
|
|
231
|
+
}
|
|
229
232
|
if ((content.attachments?.length ?? 0) > MAX_ATTACHMENT_COUNT) {
|
|
230
233
|
throw invalidProtocolFrame('Invalid Message attachments');
|
|
231
234
|
}
|
|
@@ -446,7 +449,7 @@ export function decodeTurnSnapshot(value) {
|
|
|
446
449
|
};
|
|
447
450
|
}
|
|
448
451
|
if (status === 'failed') {
|
|
449
|
-
requireShapedRecord(record, 'failed Turn snapshot', ['sessionId', 'turnId', 'runId', 'status', 'terminalEventId', 'failureClass'], ['failureMessage'
|
|
452
|
+
requireShapedRecord(record, 'failed Turn snapshot', ['sessionId', 'turnId', 'runId', 'status', 'terminalEventId', 'failureClass'], ['failureMessage']);
|
|
450
453
|
return {
|
|
451
454
|
...base,
|
|
452
455
|
status,
|
|
@@ -457,11 +460,6 @@ export function decodeTurnSnapshot(value) {
|
|
|
457
460
|
failureMessage: requireUtf8String(record.failureMessage, 'failureMessage', TURN_FAILURE_MESSAGE_MAX_BYTES, false),
|
|
458
461
|
}
|
|
459
462
|
: {}),
|
|
460
|
-
...(record.contextBudgetExhaustedDetail !== undefined
|
|
461
|
-
? {
|
|
462
|
-
contextBudgetExhaustedDetail: requireContextBudgetExhaustedDetail(record.contextBudgetExhaustedDetail),
|
|
463
|
-
}
|
|
464
|
-
: {}),
|
|
465
463
|
};
|
|
466
464
|
}
|
|
467
465
|
if (status === 'cancelled') {
|
|
@@ -489,11 +487,6 @@ export function decodeTurnSnapshot(value) {
|
|
|
489
487
|
: {}),
|
|
490
488
|
};
|
|
491
489
|
}
|
|
492
|
-
function requireContextBudgetExhaustedDetail(value) {
|
|
493
|
-
if (isContextBudgetExhaustedDetail(value))
|
|
494
|
-
return value;
|
|
495
|
-
throw invalidProtocolFrame('Invalid context budget exhausted detail');
|
|
496
|
-
}
|
|
497
490
|
export function decodeContextCompactionOutcome(value) {
|
|
498
491
|
const record = requireRecord(value, 'Context compaction outcome');
|
|
499
492
|
const kind = requireString(record.kind, 'kind', 32);
|
|
@@ -146,7 +146,7 @@ export function decodeWorkHubCoordinationCandidatesResult(value) {
|
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
148
|
export function decodeWorkHubCoordinationActInput(value) {
|
|
149
|
-
const input = requireShapedRecord(value, 'WorkHub Coordination action input', ['actionId', 'userText', 'proposal'], ['candidateSetId', 'create']);
|
|
149
|
+
const input = requireShapedRecord(value, 'WorkHub Coordination action input', ['actionId', 'userText', 'proposal'], ['candidateSetId', 'create', 'confirmation']);
|
|
150
150
|
const proposal = decodeWorkHubCoordinationProposal(input.proposal);
|
|
151
151
|
const base = {
|
|
152
152
|
actionId: requireEntityId(input.actionId, 'WorkHub Coordination action id'),
|
|
@@ -154,18 +154,45 @@ export function decodeWorkHubCoordinationActInput(value) {
|
|
|
154
154
|
proposal,
|
|
155
155
|
};
|
|
156
156
|
if (proposal.disposition === 'delegate_existing') {
|
|
157
|
-
if (input.create !== undefined ||
|
|
157
|
+
if (input.create !== undefined ||
|
|
158
|
+
input.candidateSetId === undefined ||
|
|
159
|
+
input.confirmation !== undefined) {
|
|
158
160
|
throw invalidProtocolFrame('Invalid WorkHub delegation context');
|
|
159
161
|
}
|
|
160
162
|
return { ...base, candidateSetId: candidateSetId(input.candidateSetId) };
|
|
161
163
|
}
|
|
162
164
|
if (proposal.disposition === 'create_new') {
|
|
163
|
-
if (input.candidateSetId !== undefined ||
|
|
165
|
+
if (input.candidateSetId !== undefined ||
|
|
166
|
+
input.create === undefined ||
|
|
167
|
+
input.confirmation !== undefined) {
|
|
164
168
|
throw invalidProtocolFrame('Invalid WorkHub creation context');
|
|
165
169
|
}
|
|
166
170
|
return { ...base, create: decodeWorkHubCoordinationCreateContext(input.create) };
|
|
167
171
|
}
|
|
168
|
-
if (
|
|
172
|
+
if (proposal.disposition === 'replace') {
|
|
173
|
+
const confirmation = decodeWorkHubCoordinationDestructiveConfirmation(input.confirmation);
|
|
174
|
+
if (proposal.target.disposition === 'delegate_existing') {
|
|
175
|
+
if (input.candidateSetId === undefined || input.create !== undefined) {
|
|
176
|
+
throw invalidProtocolFrame('Invalid WorkHub replacement context');
|
|
177
|
+
}
|
|
178
|
+
return {
|
|
179
|
+
...base,
|
|
180
|
+
candidateSetId: candidateSetId(input.candidateSetId),
|
|
181
|
+
confirmation,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
if (input.candidateSetId !== undefined || input.create === undefined) {
|
|
185
|
+
throw invalidProtocolFrame('Invalid WorkHub replacement creation context');
|
|
186
|
+
}
|
|
187
|
+
return {
|
|
188
|
+
...base,
|
|
189
|
+
create: decodeWorkHubCoordinationCreateContext(input.create),
|
|
190
|
+
confirmation,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
if (input.candidateSetId !== undefined ||
|
|
194
|
+
input.create !== undefined ||
|
|
195
|
+
input.confirmation !== undefined) {
|
|
169
196
|
throw invalidProtocolFrame('Unexpected WorkHub action context');
|
|
170
197
|
}
|
|
171
198
|
return base;
|
|
@@ -194,6 +221,23 @@ export function decodeWorkHubCoordinationActResult(value) {
|
|
|
194
221
|
...(exact.steered === true ? { steered: true } : {}),
|
|
195
222
|
};
|
|
196
223
|
}
|
|
224
|
+
if (result.disposition === 'replace') {
|
|
225
|
+
const exact = requireShapedRecord(result, 'WorkHub Coordination replacement result', ['disposition', 'replacementDisposition', 'targetSessionId', 'targetTurnId'], ['steered']);
|
|
226
|
+
if (exact.replacementDisposition !== 'delegate_existing' &&
|
|
227
|
+
exact.replacementDisposition !== 'create_new') {
|
|
228
|
+
throw invalidProtocolFrame('Invalid WorkHub replacement disposition');
|
|
229
|
+
}
|
|
230
|
+
if (exact.steered !== undefined && exact.steered !== true) {
|
|
231
|
+
throw invalidProtocolFrame('Invalid WorkHub Coordination steering result');
|
|
232
|
+
}
|
|
233
|
+
return {
|
|
234
|
+
disposition: 'replace',
|
|
235
|
+
replacementDisposition: exact.replacementDisposition,
|
|
236
|
+
targetSessionId: requireEntityId(exact.targetSessionId, 'WorkHub target Session id'),
|
|
237
|
+
targetTurnId: requireEntityId(exact.targetTurnId, 'WorkHub target Turn id'),
|
|
238
|
+
...(exact.steered === true ? { steered: true } : {}),
|
|
239
|
+
};
|
|
240
|
+
}
|
|
197
241
|
throw invalidProtocolFrame('Invalid WorkHub Coordination action disposition');
|
|
198
242
|
}
|
|
199
243
|
function decodeWorkHubCoordinationCandidate(value) {
|
|
@@ -250,6 +294,43 @@ function decodeWorkHubCoordinationProposal(value) {
|
|
|
250
294
|
title: requireUtf8String(exact.title, 'WorkHub Session title', COORDINATION_TITLE_MAX_BYTES),
|
|
251
295
|
};
|
|
252
296
|
}
|
|
297
|
+
if (proposal.disposition === 'replace') {
|
|
298
|
+
const exact = requireExactRecord(proposal, 'WorkHub replacement proposal', [
|
|
299
|
+
'disposition',
|
|
300
|
+
'replacesActionId',
|
|
301
|
+
'target',
|
|
302
|
+
]);
|
|
303
|
+
const target = requireRecord(exact.target, 'WorkHub replacement target');
|
|
304
|
+
if (target.disposition === 'delegate_existing') {
|
|
305
|
+
const targetExact = requireExactRecord(target, 'WorkHub replacement delegation target', [
|
|
306
|
+
'disposition',
|
|
307
|
+
'candidateRef',
|
|
308
|
+
]);
|
|
309
|
+
return {
|
|
310
|
+
disposition: 'replace',
|
|
311
|
+
replacesActionId: requireEntityId(exact.replacesActionId, 'WorkHub replaced action id'),
|
|
312
|
+
target: {
|
|
313
|
+
disposition: 'delegate_existing',
|
|
314
|
+
candidateRef: requireEntityId(targetExact.candidateRef, 'WorkHub candidate ref'),
|
|
315
|
+
},
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
if (target.disposition === 'create_new') {
|
|
319
|
+
const targetExact = requireExactRecord(target, 'WorkHub replacement creation target', [
|
|
320
|
+
'disposition',
|
|
321
|
+
'title',
|
|
322
|
+
]);
|
|
323
|
+
return {
|
|
324
|
+
disposition: 'replace',
|
|
325
|
+
replacesActionId: requireEntityId(exact.replacesActionId, 'WorkHub replaced action id'),
|
|
326
|
+
target: {
|
|
327
|
+
disposition: 'create_new',
|
|
328
|
+
title: requireUtf8String(targetExact.title, 'WorkHub Session title', COORDINATION_TITLE_MAX_BYTES),
|
|
329
|
+
},
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
throw invalidProtocolFrame('Invalid WorkHub replacement target');
|
|
333
|
+
}
|
|
253
334
|
throw invalidProtocolFrame('Invalid WorkHub Coordination proposal disposition');
|
|
254
335
|
}
|
|
255
336
|
function decodeWorkHubCoordinationCreateContext(value) {
|
|
@@ -258,6 +339,13 @@ function decodeWorkHubCoordinationCreateContext(value) {
|
|
|
258
339
|
workspace: decodeWorkspaceTarget(context.workspace),
|
|
259
340
|
};
|
|
260
341
|
}
|
|
342
|
+
function decodeWorkHubCoordinationDestructiveConfirmation(value) {
|
|
343
|
+
const confirmation = requireExactRecord(value, 'WorkHub destructive confirmation', ['kind']);
|
|
344
|
+
if (confirmation.kind !== 'user_correction') {
|
|
345
|
+
throw invalidProtocolFrame('Invalid WorkHub destructive confirmation');
|
|
346
|
+
}
|
|
347
|
+
return { kind: 'user_correction' };
|
|
348
|
+
}
|
|
261
349
|
function candidateSetId(value) {
|
|
262
350
|
const id = requireUtf8String(value, 'WorkHub candidate set id', CANDIDATE_SET_ID_MAX_BYTES);
|
|
263
351
|
if (!/^sha256:[a-f0-9]{64}$/u.test(id)) {
|
|
@@ -22,15 +22,11 @@ import { runtimeHostAccessCredentialHash } from '../access-credential-identity.j
|
|
|
22
22
|
import { encodeCollaborationInvitationCode, } from '../protocol/index.js';
|
|
23
23
|
import { createRuntimeHostConnectionAuthority, } from './connection-authority.js';
|
|
24
24
|
import { createAccessCredentialDelivery, discardAccessCredentialDelivery, purgeAccessCredentialDeliveries, } from '../control/access-credential-delivery.js';
|
|
25
|
-
import { ACCESS_FILE_NAME, assertAccessCredentialFileCapacity, createAccessCredentialFile, issuedAccessGrants, readAccessCredentialFile, RuntimeHostAccessCommitOutcomeUnknownError, RuntimeHostAccessInputError, SESSION_GUEST_OPERATION_GRANTS, writeAccessCredentialFile, } from './access-credential-store.js';
|
|
25
|
+
import { ACCESS_FILE_NAME, assertAccessCredentialFileCapacity, CAPABILITY_PROVIDER_OPERATION_GRANTS, createAccessCredentialFile, effectiveOperationGrants, issuedAccessGrants, readAccessCredentialFile, RuntimeHostAccessCommitOutcomeUnknownError, RuntimeHostAccessInputError, SESSION_GUEST_OPERATION_GRANTS, writeAccessCredentialFile, } from './access-credential-store.js';
|
|
26
26
|
const ACCESS_CREDENTIAL_PREFIX = 'maka_rh_';
|
|
27
27
|
const PENDING_CREDENTIAL_LIFETIME_MS = 15 * 60_000;
|
|
28
28
|
const TURN_ACCESS_REQUEST_ACTIVE_MAX = 4;
|
|
29
|
-
const CAPABILITY_PROVIDER_GRANTS = new Set(
|
|
30
|
-
'host.status',
|
|
31
|
-
'client.capability.replace',
|
|
32
|
-
'client.capability.unregister',
|
|
33
|
-
]);
|
|
29
|
+
const CAPABILITY_PROVIDER_GRANTS = new Set(CAPABILITY_PROVIDER_OPERATION_GRANTS);
|
|
34
30
|
function createNextAccessCredentialFile(current, credentials, sessionGrants, turnAccessRequests = current.turnAccessRequests) {
|
|
35
31
|
return createAccessCredentialFile(credentials, sessionGrants, turnAccessRequests);
|
|
36
32
|
}
|
|
@@ -79,8 +75,8 @@ class FileRuntimeHostAccessAuthority {
|
|
|
79
75
|
operationGrants: match.bindClientInstanceOnFinalize
|
|
80
76
|
? ['host.status', 'access.credential.finalize']
|
|
81
77
|
: match.clientInstanceId
|
|
82
|
-
? [...match
|
|
83
|
-
: match
|
|
78
|
+
? [...effectiveOperationGrants(match), 'access.credential.finalize']
|
|
79
|
+
: effectiveOperationGrants(match),
|
|
84
80
|
canPublishClientCapabilities: !match.bindClientInstanceOnFinalize && match.canPublishClientCapabilities,
|
|
85
81
|
canUseHostPaths: !match.bindClientInstanceOnFinalize && match.canUseHostPaths,
|
|
86
82
|
...(match.clientInstanceId ? { clientInstanceId: match.clientInstanceId } : {}),
|
|
@@ -111,7 +107,7 @@ class FileRuntimeHostAccessAuthority {
|
|
|
111
107
|
principalId,
|
|
112
108
|
principalKind: 'session_guest',
|
|
113
109
|
status: 'pending',
|
|
114
|
-
|
|
110
|
+
grants: SESSION_GUEST_OPERATION_GRANTS,
|
|
115
111
|
canPublishClientCapabilities: false,
|
|
116
112
|
canUseHostPaths: false,
|
|
117
113
|
createdAt,
|
|
@@ -219,10 +215,11 @@ class FileRuntimeHostAccessAuthority {
|
|
|
219
215
|
const guest = principal.principalKind === 'session_guest';
|
|
220
216
|
return {
|
|
221
217
|
canRequestTurns: guest &&
|
|
218
|
+
input.sessionId !== undefined &&
|
|
222
219
|
this.activeSessionGrant(principal.principalId, input.sessionId, 'session_turn_request') !==
|
|
223
220
|
undefined,
|
|
224
221
|
requests: this.#file.turnAccessRequests.filter((request) => (!guest || request.principalId === principal.principalId) &&
|
|
225
|
-
request.intent.sessionId === input.sessionId),
|
|
222
|
+
(input.sessionId === undefined || request.intent.sessionId === input.sessionId)),
|
|
226
223
|
};
|
|
227
224
|
}
|
|
228
225
|
acknowledgeTurnAccessRequest(principalId, input) {
|
|
@@ -314,17 +311,23 @@ class FileRuntimeHostAccessAuthority {
|
|
|
314
311
|
return this.#createCredential({
|
|
315
312
|
principalId: current.principalId,
|
|
316
313
|
principalKind: current.principalKind,
|
|
317
|
-
operationGrants: current
|
|
314
|
+
operationGrants: effectiveOperationGrants(current),
|
|
318
315
|
canPublishClientCapabilities: current.canPublishClientCapabilities,
|
|
319
316
|
canUseHostPaths: current.canUseHostPaths,
|
|
320
317
|
bindClientInstance: current.clientInstanceId !== undefined,
|
|
321
|
-
}, 'prepare', current.
|
|
318
|
+
}, 'prepare', current.grants);
|
|
322
319
|
});
|
|
323
320
|
}
|
|
324
321
|
#issue(input, mode) {
|
|
325
322
|
return this.#mutate(() => this.#createCredential(input, mode));
|
|
326
323
|
}
|
|
327
|
-
async #createCredential(input, mode,
|
|
324
|
+
async #createCredential(input, mode,
|
|
325
|
+
// Rotation exchanges the secret and keeps the authority, so it hands over
|
|
326
|
+
// the predecessor's record verbatim — including keys this build cannot
|
|
327
|
+
// account for. Every other path records exactly what it just issued.
|
|
328
|
+
inheritedGrants) {
|
|
329
|
+
const operationGrants = issuedAccessGrants(input.operationGrants);
|
|
330
|
+
const grants = inheritedGrants ?? operationGrants;
|
|
328
331
|
assertCredentialAuthority(input, operationGrants);
|
|
329
332
|
const capabilityOwner = this.#resolveCapabilityOwner('capabilityOwnerCredentialId' in input ? input.capabilityOwnerCredentialId : undefined);
|
|
330
333
|
if (mode === 'prepare' &&
|
|
@@ -350,7 +353,7 @@ class FileRuntimeHostAccessAuthority {
|
|
|
350
353
|
principalId: input.principalId,
|
|
351
354
|
principalKind: input.principalKind,
|
|
352
355
|
status: mode === 'prepare' ? 'pending' : 'active',
|
|
353
|
-
|
|
356
|
+
grants,
|
|
354
357
|
canPublishClientCapabilities: input.canPublishClientCapabilities,
|
|
355
358
|
canUseHostPaths: input.canUseHostPaths,
|
|
356
359
|
...(capabilityOwner ? { capabilityOwner } : {}),
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
import { join } from 'node:path';
|
|
20
20
|
import { runtimeHostAccessCredentialFingerprintFromHash } from '../access-credential-identity.js';
|
|
21
21
|
import { discoverMarkedStorageRoot, resolveExistingStorageRootControlDirectory, resolveExistingStorageRoot, } from '@maka/storage/root-authority';
|
|
22
|
-
import { ACCESS_FILE_NAME, readAccessCredentialFile } from './access-credential-store.js';
|
|
22
|
+
import { ACCESS_FILE_NAME, effectiveOperationGrants, readAccessCredentialFile, } from './access-credential-store.js';
|
|
23
23
|
export async function readRuntimeHostAccessCredentialMetadata(rootPath, expectedRootId) {
|
|
24
24
|
const capability = expectedRootId
|
|
25
25
|
? await resolveExistingStorageRoot({
|
|
@@ -45,7 +45,9 @@ export async function readRuntimeHostAccessCredentialMetadata(rootPath, expected
|
|
|
45
45
|
principalKind: credential.principalKind,
|
|
46
46
|
principalId: credential.principalId,
|
|
47
47
|
status: credential.status,
|
|
48
|
-
|
|
48
|
+
// What the credential can exercise on this build, not what its record
|
|
49
|
+
// happens to hold — an operator reading this is asking about now.
|
|
50
|
+
operationGrants: effectiveOperationGrants(credential),
|
|
49
51
|
canPublishClientCapabilities: credential.canPublishClientCapabilities,
|
|
50
52
|
canUseHostPaths: credential.canUseHostPaths,
|
|
51
53
|
createdAt: credential.createdAt,
|