maka-agent 0.2.0-dev.11.20260831 → 0.2.0-dev.12.20260901
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/dist/cli-core.js +25 -1
- 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-cli.js +150 -4
- 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 +5 -1
- 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 +13 -5
- package/dist/runtime-host-update-discovery.js +1 -0
- package/dist/tui-clipboard.js +86 -0
- package/dist/tui-copy-catalog.js +246 -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 +80 -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-readiness.js +3 -31
- package/node_modules/@maka/core/dist/deep-research.js +1 -20
- package/node_modules/@maka/core/dist/events.js +22 -1
- 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/model-catalog.js +221 -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 +4 -0
- package/node_modules/@maka/core/dist/runtime-policy/connection-catalog-codec.js +34 -18
- package/node_modules/@maka/core/dist/runtime-policy/model-catalog-entry-codec.js +75 -0
- package/node_modules/@maka/core/dist/runtime-policy.js +2 -1
- 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 +119 -5
- 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/workhub-creation-intent.js +896 -0
- package/node_modules/@maka/core/package.json +6 -1
- package/node_modules/@maka/runtime/dist/agent-run.js +7 -0
- package/node_modules/@maka/runtime/dist/ai-sdk-backend.js +3 -2
- 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 +18 -1
- 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/quiescent-session-snapshot.js +78 -0
- package/node_modules/@maka/runtime/dist/runtime-event-backfill.js +3 -0
- package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +1 -0
- package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +8 -4
- 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-runtime.js +50 -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 -0
- package/node_modules/@maka/runtime-host/dist/client/catalog-reader.js +19 -5
- package/node_modules/@maka/runtime-host/dist/client/client-capability-channel.js +3 -2
- package/node_modules/@maka/runtime-host/dist/client/connection.js +22 -0
- package/node_modules/@maka/runtime-host/dist/client/host-profile.js +1 -0
- package/node_modules/@maka/runtime-host/dist/client/index.js +1 -0
- package/node_modules/@maka/runtime-host/dist/client/oauth-presentation.js +1 -1
- package/node_modules/@maka/runtime-host/dist/client/peer-client.js +4 -0
- package/node_modules/@maka/runtime-host/dist/client/reconnecting-connection.js +8 -0
- 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/owner.js +1 -0
- package/node_modules/@maka/runtime-host/dist/protocol/client-capability.js +22 -1
- 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/index.js +33 -1
- package/node_modules/@maka/runtime-host/dist/protocol/operations.js +3 -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 +25 -61
- package/node_modules/@maka/runtime-host/dist/protocol/session-catalog.js +1 -1
- package/node_modules/@maka/runtime-host/dist/protocol/turn.js +4 -1
- package/node_modules/@maka/runtime-host/dist/protocol/workhub-coordination.js +92 -4
- package/node_modules/@maka/runtime-host/dist/server/access-authority.js +15 -13
- 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/bootstrap-runtime-policy.js +10 -4
- 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/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 +117 -4
- package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +2 -2
- 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/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/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/operation-dispatcher.js +43 -118
- 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 +29 -4
- package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +2 -1
- 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 +16 -36
- package/node_modules/@maka/storage/dist/runtime-policy/onboarding-transaction.js +2 -2
- package/node_modules/@maka/storage/dist/runtime-policy-stores.js +1 -1
- 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/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/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
package/dist/runtime-host-cli.js
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import { isAbsolute } from 'node:path';
|
|
20
20
|
import { isProductReleaseVersion, isSha512PackageIntegrity, } from '@maka/runtime-host/operator/update-package-evidence';
|
|
21
|
+
import { decodeRuntimeHostWebRtcStunPolicy, } from '@maka/runtime-host/operator';
|
|
21
22
|
import { canonicalProjectDirectoryRootSpec, isCanonicalRuntimeHostWebSocketPath, PROJECT_DIRECTORY_MAX_ROOTS, projectDirectoryPosixRootSpecValid, projectDirectoryRootSpecValid, } from '@maka/runtime-host/protocol';
|
|
22
23
|
import { hasEphemeralRuntimeHostPeerPort } from './runtime-host-peer-artifact.js';
|
|
23
24
|
export function parseRuntimeHostCommand(argv) {
|
|
@@ -40,6 +41,8 @@ export function parseRuntimeHostCommand(argv) {
|
|
|
40
41
|
return parseAccessCommand(argv.slice(1));
|
|
41
42
|
if (argv[0] === 'project')
|
|
42
43
|
return parseProjectCommand(argv.slice(1));
|
|
44
|
+
if (argv[0] === 'plugin')
|
|
45
|
+
return parsePluginCommand(argv.slice(1));
|
|
43
46
|
if (argv[0] === 'capability-provider') {
|
|
44
47
|
return parseCapabilityProviderCommand(argv.slice(1));
|
|
45
48
|
}
|
|
@@ -47,7 +50,7 @@ export function parseRuntimeHostCommand(argv) {
|
|
|
47
50
|
return parseProfileCommand(argv.slice(1));
|
|
48
51
|
return error(argv[0]
|
|
49
52
|
? `Unexpected runtime-host command: ${argv[0]}`
|
|
50
|
-
: 'runtime-host requires the activate, connect, serve, setup, service, access, project, profile, or capability-provider command');
|
|
53
|
+
: 'runtime-host requires the activate, connect, serve, setup, service, access, project, plugin, profile, or capability-provider command');
|
|
51
54
|
}
|
|
52
55
|
function parseManagedRootFramedCommand(action, argv) {
|
|
53
56
|
let rootId;
|
|
@@ -487,6 +490,7 @@ function parseServiceManagementCommand(argv) {
|
|
|
487
490
|
}
|
|
488
491
|
let retainManagedDeployment = false;
|
|
489
492
|
let allowInterruptActiveTasks = false;
|
|
493
|
+
let allowManualUpdate = false;
|
|
490
494
|
let clientDataRoot;
|
|
491
495
|
let updateTarget;
|
|
492
496
|
let expectedHost;
|
|
@@ -505,7 +509,7 @@ function parseServiceManagementCommand(argv) {
|
|
|
505
509
|
allowInterruptActiveTasks = true;
|
|
506
510
|
},
|
|
507
511
|
}
|
|
508
|
-
: action === '
|
|
512
|
+
: action === 'update'
|
|
509
513
|
? {
|
|
510
514
|
'--allow-interrupt-active-tasks': () => {
|
|
511
515
|
if (allowInterruptActiveTasks) {
|
|
@@ -513,8 +517,22 @@ function parseServiceManagementCommand(argv) {
|
|
|
513
517
|
}
|
|
514
518
|
allowInterruptActiveTasks = true;
|
|
515
519
|
},
|
|
520
|
+
'--allow-manual-update': () => {
|
|
521
|
+
if (allowManualUpdate)
|
|
522
|
+
return error('Duplicate --allow-manual-update');
|
|
523
|
+
allowManualUpdate = true;
|
|
524
|
+
},
|
|
516
525
|
}
|
|
517
|
-
:
|
|
526
|
+
: action === 'restart' || action === 'retire' || action === 'configure'
|
|
527
|
+
? {
|
|
528
|
+
'--allow-interrupt-active-tasks': () => {
|
|
529
|
+
if (allowInterruptActiveTasks) {
|
|
530
|
+
return error('Duplicate --allow-interrupt-active-tasks');
|
|
531
|
+
}
|
|
532
|
+
allowInterruptActiveTasks = true;
|
|
533
|
+
},
|
|
534
|
+
}
|
|
535
|
+
: {};
|
|
518
536
|
const options = parseManagedServiceOptions(argv.slice(1), {
|
|
519
537
|
allowConfiguration: action === 'install' || action === 'configure',
|
|
520
538
|
allowFramed: true,
|
|
@@ -635,6 +653,12 @@ function parseServiceManagementCommand(argv) {
|
|
|
635
653
|
const selector = updateTarget === undefined ? undefined : parseUpdateSelector(updateTarget, 'update');
|
|
636
654
|
if (selector && 'kind' in selector && selector.kind === 'error')
|
|
637
655
|
return selector;
|
|
656
|
+
if (allowManualUpdate &&
|
|
657
|
+
(selector?.kind !== 'exact' ||
|
|
658
|
+
!options.managedRootId ||
|
|
659
|
+
!options.expectedTarget?.deploymentId)) {
|
|
660
|
+
return error('--allow-manual-update requires an exact --target, --managed-root-id, and --expected-deployment-id');
|
|
661
|
+
}
|
|
638
662
|
return {
|
|
639
663
|
kind: 'runtime-host-service-update',
|
|
640
664
|
json: options.json,
|
|
@@ -647,6 +671,7 @@ function parseServiceManagementCommand(argv) {
|
|
|
647
671
|
expectedTarget: options.expectedTarget,
|
|
648
672
|
...(expectedHost ? { expectedHost } : {}),
|
|
649
673
|
...(selector ? { selector } : {}),
|
|
674
|
+
...(allowManualUpdate ? { allowManualUpdate: true } : {}),
|
|
650
675
|
...(allowInterruptActiveTasks ? { allowInterruptActiveTasks: true } : {}),
|
|
651
676
|
};
|
|
652
677
|
}
|
|
@@ -683,6 +708,10 @@ function parseServicePeerCommand(argv) {
|
|
|
683
708
|
let clearCoordinationRelays = false;
|
|
684
709
|
let automaticRelayDiscovery;
|
|
685
710
|
let relayDiscoveryStatus = false;
|
|
711
|
+
let defaultPublicStun = false;
|
|
712
|
+
let noPublicStun = false;
|
|
713
|
+
let webRtcStunStatus = false;
|
|
714
|
+
const webRtcStunUrls = [];
|
|
686
715
|
let allowInterruptActiveTasks = false;
|
|
687
716
|
const options = parseManagedServiceOptions(argv.slice(1), {
|
|
688
717
|
allowConfiguration: false,
|
|
@@ -715,6 +744,21 @@ function parseServicePeerCommand(argv) {
|
|
|
715
744
|
return error('Duplicate --relay-discovery-status');
|
|
716
745
|
relayDiscoveryStatus = true;
|
|
717
746
|
},
|
|
747
|
+
'--default-public-stun': () => {
|
|
748
|
+
if (defaultPublicStun)
|
|
749
|
+
return error('Duplicate --default-public-stun');
|
|
750
|
+
defaultPublicStun = true;
|
|
751
|
+
},
|
|
752
|
+
'--no-public-stun': () => {
|
|
753
|
+
if (noPublicStun)
|
|
754
|
+
return error('Duplicate --no-public-stun');
|
|
755
|
+
noPublicStun = true;
|
|
756
|
+
},
|
|
757
|
+
'--webrtc-stun-status': () => {
|
|
758
|
+
if (webRtcStunStatus)
|
|
759
|
+
return error('Duplicate --webrtc-stun-status');
|
|
760
|
+
webRtcStunStatus = true;
|
|
761
|
+
},
|
|
718
762
|
},
|
|
719
763
|
valueOptions: {
|
|
720
764
|
'--client-data-root': (value) => {
|
|
@@ -730,6 +774,9 @@ function parseServicePeerCommand(argv) {
|
|
|
730
774
|
'--coordination-relay': (value) => {
|
|
731
775
|
coordinationRelays.push(value);
|
|
732
776
|
},
|
|
777
|
+
'--webrtc-stun': (value) => {
|
|
778
|
+
webRtcStunUrls.push(value);
|
|
779
|
+
},
|
|
733
780
|
},
|
|
734
781
|
});
|
|
735
782
|
if ('kind' in options)
|
|
@@ -740,6 +787,25 @@ function parseServicePeerCommand(argv) {
|
|
|
740
787
|
if (relayDiscoveryStatus && !options.framed) {
|
|
741
788
|
return error('--relay-discovery-status requires --framed');
|
|
742
789
|
}
|
|
790
|
+
if (webRtcStunStatus && !options.framed) {
|
|
791
|
+
return error('--webrtc-stun-status requires --framed');
|
|
792
|
+
}
|
|
793
|
+
if (Number(defaultPublicStun) + Number(noPublicStun) + Number(webRtcStunUrls.length > 0) > 1) {
|
|
794
|
+
return error('Specify only one WebRTC STUN policy');
|
|
795
|
+
}
|
|
796
|
+
let webRtcStunPolicy;
|
|
797
|
+
try {
|
|
798
|
+
webRtcStunPolicy = defaultPublicStun
|
|
799
|
+
? { kind: 'default' }
|
|
800
|
+
: noPublicStun
|
|
801
|
+
? { kind: 'disabled' }
|
|
802
|
+
: webRtcStunUrls.length > 0
|
|
803
|
+
? decodeRuntimeHostWebRtcStunPolicy({ kind: 'custom', urls: webRtcStunUrls })
|
|
804
|
+
: undefined;
|
|
805
|
+
}
|
|
806
|
+
catch (failure) {
|
|
807
|
+
return error(failure instanceof Error ? failure.message : String(failure));
|
|
808
|
+
}
|
|
743
809
|
if (listenAddresses.some(hasEphemeralRuntimeHostPeerPort)) {
|
|
744
810
|
return error('--listen requires a stable non-zero transport port');
|
|
745
811
|
}
|
|
@@ -750,7 +816,8 @@ function parseServicePeerCommand(argv) {
|
|
|
750
816
|
(listenAddresses.length > 0 ||
|
|
751
817
|
coordinationRelays.length > 0 ||
|
|
752
818
|
clearCoordinationRelays ||
|
|
753
|
-
automaticRelayDiscovery !== undefined
|
|
819
|
+
automaticRelayDiscovery !== undefined ||
|
|
820
|
+
webRtcStunPolicy !== undefined)) {
|
|
754
821
|
return error('Peer listener options are only valid with peer enable');
|
|
755
822
|
}
|
|
756
823
|
if (allowInterruptActiveTasks && action !== 'enable' && action !== 'disable') {
|
|
@@ -782,6 +849,8 @@ function parseServicePeerCommand(argv) {
|
|
|
782
849
|
: {}),
|
|
783
850
|
...(automaticRelayDiscovery === undefined ? {} : { automaticRelayDiscovery }),
|
|
784
851
|
...(relayDiscoveryStatus ? { relayDiscoveryStatus: true } : {}),
|
|
852
|
+
...(webRtcStunPolicy ? { webRtcStunPolicy } : {}),
|
|
853
|
+
...(webRtcStunStatus ? { webRtcStunStatus: true } : {}),
|
|
785
854
|
...(options.expectedTarget ? { expectedTarget: options.expectedTarget } : {}),
|
|
786
855
|
...(allowInterruptActiveTasks ? { allowInterruptActiveTasks: true } : {}),
|
|
787
856
|
};
|
|
@@ -1169,6 +1238,83 @@ function parseProjectCommand(argv) {
|
|
|
1169
1238
|
...(rootPath ? { rootPath } : {}),
|
|
1170
1239
|
};
|
|
1171
1240
|
}
|
|
1241
|
+
function parsePluginCommand(argv) {
|
|
1242
|
+
const action = argv[0];
|
|
1243
|
+
const actions = [
|
|
1244
|
+
'status',
|
|
1245
|
+
'list',
|
|
1246
|
+
'inspect',
|
|
1247
|
+
'failures',
|
|
1248
|
+
'install',
|
|
1249
|
+
'uninstall',
|
|
1250
|
+
'reload',
|
|
1251
|
+
'export',
|
|
1252
|
+
'apply',
|
|
1253
|
+
'reconcile',
|
|
1254
|
+
];
|
|
1255
|
+
if (!actions.includes(action)) {
|
|
1256
|
+
return error(action
|
|
1257
|
+
? `Unexpected runtime-host plugin command: ${action}`
|
|
1258
|
+
: 'runtime-host plugin requires an action');
|
|
1259
|
+
}
|
|
1260
|
+
let rootPath;
|
|
1261
|
+
let rootId;
|
|
1262
|
+
let cursor;
|
|
1263
|
+
let limit;
|
|
1264
|
+
const positional = [];
|
|
1265
|
+
for (let index = 1; index < argv.length; index += 1) {
|
|
1266
|
+
const argument = argv[index];
|
|
1267
|
+
if (argument === '--root' ||
|
|
1268
|
+
argument === '--scope' ||
|
|
1269
|
+
argument === '--cursor' ||
|
|
1270
|
+
argument === '--limit') {
|
|
1271
|
+
const parsed = optionValue(argv, index, argument);
|
|
1272
|
+
if (typeof parsed !== 'string')
|
|
1273
|
+
return parsed;
|
|
1274
|
+
if (argument === '--root')
|
|
1275
|
+
rootPath = parsed;
|
|
1276
|
+
else if (argument === '--scope')
|
|
1277
|
+
rootId = parsed;
|
|
1278
|
+
else if (argument === '--cursor')
|
|
1279
|
+
cursor = parsed;
|
|
1280
|
+
else {
|
|
1281
|
+
const numeric = Number(parsed);
|
|
1282
|
+
if (!Number.isSafeInteger(numeric) || numeric < 0 || numeric < 1 || numeric > 64) {
|
|
1283
|
+
return error('--limit requires an integer between 1 and 64');
|
|
1284
|
+
}
|
|
1285
|
+
limit = numeric;
|
|
1286
|
+
}
|
|
1287
|
+
index += 1;
|
|
1288
|
+
continue;
|
|
1289
|
+
}
|
|
1290
|
+
positional.push(argument ?? '');
|
|
1291
|
+
}
|
|
1292
|
+
const selected = action;
|
|
1293
|
+
const expected = selected === 'export'
|
|
1294
|
+
? 2
|
|
1295
|
+
: ['install', 'uninstall', 'reload', 'apply'].includes(selected)
|
|
1296
|
+
? 1
|
|
1297
|
+
: 0;
|
|
1298
|
+
if (positional.length !== expected) {
|
|
1299
|
+
return error(`runtime-host plugin ${selected} requires ${expected} target${expected === 1 ? '' : 's'}`);
|
|
1300
|
+
}
|
|
1301
|
+
if (rootId && selected !== 'inspect')
|
|
1302
|
+
return error('--scope is only valid for plugin inspect');
|
|
1303
|
+
if ((cursor !== undefined || limit !== undefined) &&
|
|
1304
|
+
!['list', 'inspect', 'failures'].includes(selected)) {
|
|
1305
|
+
return error('--cursor and --limit require a paged Plugin query');
|
|
1306
|
+
}
|
|
1307
|
+
return {
|
|
1308
|
+
kind: 'runtime-host-plugin',
|
|
1309
|
+
action: selected,
|
|
1310
|
+
...(rootPath ? { rootPath } : {}),
|
|
1311
|
+
...(positional[0] ? { subject: positional[0] } : {}),
|
|
1312
|
+
...(positional[1] ? { targetPath: positional[1] } : {}),
|
|
1313
|
+
...(rootId ? { rootId } : {}),
|
|
1314
|
+
...(cursor ? { cursor } : {}),
|
|
1315
|
+
...(limit === undefined ? {} : { limit }),
|
|
1316
|
+
};
|
|
1317
|
+
}
|
|
1172
1318
|
function parseProfileCommand(argv) {
|
|
1173
1319
|
const action = argv[0];
|
|
1174
1320
|
if (action === 'list') {
|
|
@@ -118,10 +118,11 @@ export async function resolveRecoverableRuntimeHostManagedDeployment(rootId, dep
|
|
|
118
118
|
? { supervisor: previousProvider.supervisor }
|
|
119
119
|
: {}),
|
|
120
120
|
...(options.expectedOwner ? { expectedOwner: options.expectedOwner } : {}),
|
|
121
|
+
allowInterruptActiveTasks: options.allowInterruptActiveTasks ?? false,
|
|
121
122
|
retireIdleSupervisor: false,
|
|
122
123
|
});
|
|
123
124
|
if (retirement.kind === 'active_tasks') {
|
|
124
|
-
throw new RuntimeHostLifecycleTransactionError('
|
|
125
|
+
throw new RuntimeHostLifecycleTransactionError('active_tasks', 'Runtime Host lifecycle recovery is waiting for active work to finish');
|
|
125
126
|
}
|
|
126
127
|
let recovered;
|
|
127
128
|
let current;
|
|
@@ -206,10 +207,12 @@ export async function retireRuntimeHostLifecycleOwner(input) {
|
|
|
206
207
|
});
|
|
207
208
|
assertExpectedRuntimeHostOwner(input.expectedOwner, 'registration' in connected ? connected.registration : undefined);
|
|
208
209
|
if (connected.kind !== 'connected') {
|
|
209
|
-
if (input.
|
|
210
|
+
if (input.supervisor) {
|
|
210
211
|
const status = await input.supervisor.status();
|
|
211
212
|
assertExpectedSupervisorOwner(input.expectedOwner, status);
|
|
212
213
|
if (status.active && status.pid !== null) {
|
|
214
|
+
if (!input.allowInterruptActiveTasks)
|
|
215
|
+
return { kind: 'active_tasks' };
|
|
213
216
|
await input.supervisor.retire();
|
|
214
217
|
return waitForRuntimeHostLifecycleOwner(capability, input.timeoutMs ?? 45_000);
|
|
215
218
|
}
|
|
@@ -30,6 +30,7 @@ export async function manageRuntimeHostManagedLifecycle(rootId, input, dependenc
|
|
|
30
30
|
};
|
|
31
31
|
const resolved = await resolveRecoverableRuntimeHostManagedDeployment(rootId, lifecycleDeps, {
|
|
32
32
|
...(input.expectedTarget ? { expectedTarget: input.expectedTarget } : {}),
|
|
33
|
+
allowInterruptActiveTasks: input.allowInterruptActiveTasks ?? false,
|
|
33
34
|
});
|
|
34
35
|
if (resolved.kind === 'absent') {
|
|
35
36
|
if (input.action === 'uninstall' && input.expectedTarget) {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* specific language governing permissions and limitations
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
|
-
import {
|
|
19
|
+
import { offerableCatalogEntries } from '@maka/core/llm-connections';
|
|
20
20
|
import { readRuntimeHostConnectionCatalog, } from '@maka/runtime-host/client';
|
|
21
21
|
import { listApiKeyOnboardableProviders } from './onboarding-catalog.js';
|
|
22
22
|
/** Adapt the TUI onboarding workflow to Host-owned verification and persistence. */
|
|
@@ -84,27 +84,23 @@ export function createRuntimeHostOnboardingSurface(connection) {
|
|
|
84
84
|
export function projectRuntimeHostModelChoices(catalog) {
|
|
85
85
|
const choices = [];
|
|
86
86
|
for (const connection of catalog.connections) {
|
|
87
|
-
//
|
|
88
|
-
//
|
|
89
|
-
//
|
|
90
|
-
//
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
const ids = new Set(connection.enabledModelIds);
|
|
95
|
-
if (catalog.defaultTarget?.connectionId === connection.connectionId) {
|
|
96
|
-
ids.add(catalog.defaultTarget.modelId);
|
|
97
|
-
}
|
|
98
|
-
for (const model of ids) {
|
|
87
|
+
// Which models are offerable, and what is true about them, are both the
|
|
88
|
+
// Host's answers. A TUI older or newer than the Host must not re-derive
|
|
89
|
+
// either against its own registry and bundled metadata — that is how the
|
|
90
|
+
// same model came to be selectable here and refused elsewhere. A retained
|
|
91
|
+
// retired connection drops out through the same gate: its entries are not
|
|
92
|
+
// chat-capable, so none of them reach this list.
|
|
93
|
+
for (const entry of offerableCatalogEntries(connection)) {
|
|
99
94
|
choices.push({
|
|
100
95
|
connectionId: connection.connectionId,
|
|
101
96
|
connectionSlug: connection.slug,
|
|
102
97
|
connectionName: connection.name,
|
|
103
98
|
providerType: connection.providerType,
|
|
104
|
-
model,
|
|
105
|
-
displayName:
|
|
99
|
+
model: entry.id,
|
|
100
|
+
displayName: entry.displayName,
|
|
106
101
|
isDefaultConnection: catalog.defaultTarget?.connectionId === connection.connectionId,
|
|
107
|
-
contextWindow:
|
|
102
|
+
contextWindow: entry.contextWindow,
|
|
103
|
+
thinkingLevels: entry.thinkingLevels,
|
|
108
104
|
});
|
|
109
105
|
}
|
|
110
106
|
}
|
|
@@ -165,7 +165,7 @@ async function runCanonicalRuntimeHostPeerManagementLocked(options, deps) {
|
|
|
165
165
|
if (options.action === 'descriptor') {
|
|
166
166
|
throw new TypeError('Direct-peer descriptor does not support framed output');
|
|
167
167
|
}
|
|
168
|
-
const framedStatus =
|
|
168
|
+
const framedStatus = omitUnrequestedPeerStatus(status, options);
|
|
169
169
|
writePeerFrame(options.action === 'status'
|
|
170
170
|
? { kind: 'result', action: options.action, status: framedStatus }
|
|
171
171
|
: {
|
|
@@ -186,9 +186,13 @@ async function runCanonicalRuntimeHostPeerManagementLocked(options, deps) {
|
|
|
186
186
|
}
|
|
187
187
|
return 0;
|
|
188
188
|
}
|
|
189
|
-
function
|
|
190
|
-
const { automaticRelayDiscovery
|
|
191
|
-
return
|
|
189
|
+
function omitUnrequestedPeerStatus(status, options) {
|
|
190
|
+
const { automaticRelayDiscovery, webRtcStunPolicy, ...legacy } = status;
|
|
191
|
+
return {
|
|
192
|
+
...legacy,
|
|
193
|
+
...(options.relayDiscoveryStatus ? { automaticRelayDiscovery } : {}),
|
|
194
|
+
...(options.webRtcStunStatus ? { webRtcStunPolicy } : {}),
|
|
195
|
+
};
|
|
192
196
|
}
|
|
193
197
|
async function prepareCanonicalPeer(options, config, current) {
|
|
194
198
|
const layout = resolveRuntimeHostNpmDeploymentLayout(config.deploymentRoot, config.launch.package.integrity);
|
|
@@ -215,8 +219,14 @@ async function prepareCanonicalPeer(options, config, current) {
|
|
|
215
219
|
...new Set(options.coordinationRelays ?? current?.coordinationRelays ?? []),
|
|
216
220
|
],
|
|
217
221
|
automaticRelayDiscovery: options.automaticRelayDiscovery ?? current?.automaticRelayDiscovery ?? true,
|
|
222
|
+
webRtcStunPolicy: canonicalWebRtcStunPolicy(options.webRtcStunPolicy ?? current?.webRtcStunPolicy ?? { kind: 'default' }),
|
|
218
223
|
};
|
|
219
224
|
}
|
|
225
|
+
function canonicalWebRtcStunPolicy(policy) {
|
|
226
|
+
return policy.kind === 'custom'
|
|
227
|
+
? { kind: 'custom', urls: [...policy.urls] }
|
|
228
|
+
: { kind: policy.kind };
|
|
229
|
+
}
|
|
220
230
|
async function readCanonicalPeerStatus(options, config) {
|
|
221
231
|
const result = await manageRuntimeHostManagedLifecycle(options.managedRootId, {
|
|
222
232
|
action: 'status',
|
|
@@ -234,6 +244,7 @@ async function readCanonicalPeerStatus(options, config) {
|
|
|
234
244
|
routeHints: [],
|
|
235
245
|
coordinationRelays: [],
|
|
236
246
|
automaticRelayDiscovery: true,
|
|
247
|
+
webRtcStunPolicy: { kind: 'default' },
|
|
237
248
|
};
|
|
238
249
|
}
|
|
239
250
|
return {
|
|
@@ -244,6 +255,7 @@ async function readCanonicalPeerStatus(options, config) {
|
|
|
244
255
|
routeHints: expandWildcardListenAddresses(peer.listenAddresses),
|
|
245
256
|
coordinationRelays: [...peer.coordinationRelays],
|
|
246
257
|
automaticRelayDiscovery: peer.automaticRelayDiscovery,
|
|
258
|
+
webRtcStunPolicy: peer.webRtcStunPolicy,
|
|
247
259
|
};
|
|
248
260
|
}
|
|
249
261
|
function writePeerActiveTasks(options, message, deps) {
|
|
@@ -0,0 +1,101 @@
|
|
|
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 { connectExistingRuntimeHost } from '@maka/runtime-host/client';
|
|
20
|
+
import { RUNTIME_HOST_PROTOCOL_VERSION } from '@maka/runtime-host/protocol';
|
|
21
|
+
import { readFile } from 'node:fs/promises';
|
|
22
|
+
import { resolve } from 'node:path';
|
|
23
|
+
const PROTOCOL = {
|
|
24
|
+
min: RUNTIME_HOST_PROTOCOL_VERSION,
|
|
25
|
+
max: RUNTIME_HOST_PROTOCOL_VERSION,
|
|
26
|
+
};
|
|
27
|
+
export async function runRuntimeHostPluginCli(command, overrides = {}) {
|
|
28
|
+
const deps = { ...defaultDeps(), ...overrides };
|
|
29
|
+
const connection = await deps.connect(command.rootPath);
|
|
30
|
+
try {
|
|
31
|
+
const result = await execute(connection, command, deps.readText);
|
|
32
|
+
deps.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
finally {
|
|
36
|
+
await connection.close();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async function execute(connection, command, readText) {
|
|
40
|
+
const paging = {
|
|
41
|
+
...(command.cursor === undefined ? {} : { cursor: command.cursor }),
|
|
42
|
+
...(command.limit === undefined ? {} : { limit: command.limit }),
|
|
43
|
+
};
|
|
44
|
+
switch (command.action) {
|
|
45
|
+
case 'status':
|
|
46
|
+
return await connection.request('plugin.platform.query', { view: 'status' });
|
|
47
|
+
case 'list':
|
|
48
|
+
return await connection.request('plugin.platform.query', { view: 'packages', ...paging });
|
|
49
|
+
case 'inspect':
|
|
50
|
+
return await connection.request('plugin.platform.query', {
|
|
51
|
+
view: 'entries',
|
|
52
|
+
...paging,
|
|
53
|
+
...(command.rootId ? { rootId: command.rootId } : {}),
|
|
54
|
+
});
|
|
55
|
+
case 'failures':
|
|
56
|
+
return await connection.request('plugin.platform.query', { view: 'failures', ...paging });
|
|
57
|
+
case 'install':
|
|
58
|
+
return await connection.request('plugin.package.install', {
|
|
59
|
+
sourcePath: resolve(requireSubject(command)),
|
|
60
|
+
});
|
|
61
|
+
case 'uninstall':
|
|
62
|
+
return await connection.request('plugin.package.uninstall', {
|
|
63
|
+
extensionId: requireSubject(command),
|
|
64
|
+
});
|
|
65
|
+
case 'reload':
|
|
66
|
+
return await connection.request('plugin.package.reload', {
|
|
67
|
+
extensionId: requireSubject(command),
|
|
68
|
+
});
|
|
69
|
+
case 'export':
|
|
70
|
+
return await connection.request('plugin.package.export', {
|
|
71
|
+
extensionId: requireSubject(command),
|
|
72
|
+
targetPath: resolve(command.targetPath ?? missing('Plugin export target path')),
|
|
73
|
+
});
|
|
74
|
+
case 'apply': {
|
|
75
|
+
const decoded = JSON.parse(await readText(resolve(requireSubject(command))));
|
|
76
|
+
return await connection.request('plugin.composition.apply', decoded);
|
|
77
|
+
}
|
|
78
|
+
case 'reconcile':
|
|
79
|
+
return await connection.request('plugin.platform.reconcile', {});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function requireSubject(command) {
|
|
83
|
+
return command.subject ?? missing(`Plugin ${command.action} target`);
|
|
84
|
+
}
|
|
85
|
+
function missing(label) {
|
|
86
|
+
throw new Error(`${label} is missing`);
|
|
87
|
+
}
|
|
88
|
+
function defaultDeps() {
|
|
89
|
+
return {
|
|
90
|
+
connect: connectLocalOwner,
|
|
91
|
+
readText: (path) => readFile(path, 'utf8'),
|
|
92
|
+
write: (value) => process.stdout.write(value),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
async function connectLocalOwner(rootPath) {
|
|
96
|
+
const result = await connectExistingRuntimeHost({ rootPath, protocol: PROTOCOL });
|
|
97
|
+
if (result.kind !== 'connected') {
|
|
98
|
+
throw new Error(`Runtime Host service is not available (${result.kind})`);
|
|
99
|
+
}
|
|
100
|
+
return result.connection;
|
|
101
|
+
}
|
|
@@ -314,7 +314,11 @@ class RuntimeHostRunRuntime {
|
|
|
314
314
|
await this.#observer?.(active.outcome.outcome('fail'));
|
|
315
315
|
}
|
|
316
316
|
async #stopTurn(turn) {
|
|
317
|
-
await this.#connection.request('turn.stop',
|
|
317
|
+
await this.#connection.request('turn.stop', {
|
|
318
|
+
sessionId: turn.sessionId,
|
|
319
|
+
turnId: turn.turnId,
|
|
320
|
+
runId: turn.runId,
|
|
321
|
+
});
|
|
318
322
|
}
|
|
319
323
|
async #stopGraph(sessionId) {
|
|
320
324
|
try {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import { truncateUtf8 } from '@maka/core/diagnostic-log';
|
|
20
20
|
import { release } from 'node:os';
|
|
21
|
-
import { assertRuntimeHostManagedDeploymentAuthorityDurablyAbsent, encodeRuntimeHostServiceManagementFrame, RUNTIME_HOST_OPERATOR_ACCESS_MANAGEMENT_CAPABILITY, RUNTIME_HOST_OPERATOR_CAPABILITY_REQUEST_ENV, RUNTIME_HOST_OPERATOR_PEER_MANAGEMENT_CAPABILITY, RUNTIME_HOST_OPERATOR_PEER_RELAY_DISCOVERY_CAPABILITY, RUNTIME_HOST_OPERATOR_PROJECT_DIRECTORY_CONFIGURATION_REQUEST_ENV, RUNTIME_HOST_OPERATOR_PROCESS_LIFETIME_LOCK_CAPABILITY, RUNTIME_HOST_SERVICE_ERROR_CODE_MAX_BYTES, RUNTIME_HOST_SERVICE_ERROR_MESSAGE_MAX_BYTES, } from '@maka/runtime-host/operator';
|
|
21
|
+
import { assertRuntimeHostManagedDeploymentAuthorityDurablyAbsent, encodeRuntimeHostServiceManagementFrame, RUNTIME_HOST_OPERATOR_ACCESS_MANAGEMENT_CAPABILITY, RUNTIME_HOST_OPERATOR_CAPABILITY_REQUEST_ENV, RUNTIME_HOST_OPERATOR_PEER_MANAGEMENT_CAPABILITY, RUNTIME_HOST_OPERATOR_PEER_RELAY_DISCOVERY_CAPABILITY, RUNTIME_HOST_OPERATOR_PEER_WEBRTC_STUN_CAPABILITY, RUNTIME_HOST_OPERATOR_PROJECT_DIRECTORY_CONFIGURATION_REQUEST_ENV, RUNTIME_HOST_OPERATOR_PROCESS_LIFETIME_LOCK_CAPABILITY, RUNTIME_HOST_SERVICE_ERROR_CODE_MAX_BYTES, RUNTIME_HOST_SERVICE_ERROR_MESSAGE_MAX_BYTES, } from '@maka/runtime-host/operator';
|
|
22
22
|
import { resolveExistingStorageRoot, tryAcquireStateRootOwner } from '@maka/storage/root-authority';
|
|
23
23
|
import { cleanupRuntimeHostManagedDeployment, effectiveRuntimeHostProjectDirectoryRoots, manageRuntimeHostService, resolveRuntimeHostManagedServiceConfigPath, resolveRuntimeHostManagedServiceId, runtimeHostManagedServiceConfigFingerprint, RuntimeHostServiceManagerError, withRuntimeHostManagedServiceDeploymentLock, withRuntimeHostManagedServiceLifecycleLock, } from './runtime-host-service-manager.js';
|
|
24
24
|
import { createLaunchAgentRuntimeHostService } from './runtime-host-launch-agent-service.js';
|
|
@@ -277,6 +277,7 @@ function requestedOperatorCapabilities() {
|
|
|
277
277
|
if (requested === RUNTIME_HOST_OPERATOR_ACCESS_MANAGEMENT_CAPABILITY ||
|
|
278
278
|
requested === RUNTIME_HOST_OPERATOR_PEER_MANAGEMENT_CAPABILITY ||
|
|
279
279
|
requested === RUNTIME_HOST_OPERATOR_PEER_RELAY_DISCOVERY_CAPABILITY ||
|
|
280
|
+
requested === RUNTIME_HOST_OPERATOR_PEER_WEBRTC_STUN_CAPABILITY ||
|
|
280
281
|
requested === RUNTIME_HOST_OPERATOR_PROCESS_LIFETIME_LOCK_CAPABILITY) {
|
|
281
282
|
capabilities.push(requested);
|
|
282
283
|
}
|
|
@@ -383,6 +383,7 @@ async function prepareSupervisedDirectPeer(options, deps, cliPath, deploymentRoo
|
|
|
383
383
|
...(options.directPeer?.coordinationRelays ?? current?.coordinationRelays ?? []),
|
|
384
384
|
],
|
|
385
385
|
automaticRelayDiscovery: current?.automaticRelayDiscovery ?? true,
|
|
386
|
+
webRtcStunPolicy: current?.webRtcStunPolicy ?? { kind: 'default' },
|
|
386
387
|
};
|
|
387
388
|
}
|
|
388
389
|
function sameDesiredManagedDeployment(current, desired) {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import { stat } from 'node:fs/promises';
|
|
20
20
|
import { deriveTaskSubmissionReadiness, } from '@maka/core/task-submission-readiness';
|
|
21
|
-
import {
|
|
21
|
+
import { PROVIDER_REGISTRY } from '@maka/core/llm-connections';
|
|
22
22
|
import { providerAuthRequiresSecret } from '@maka/core/llm-connections';
|
|
23
23
|
export async function readRuntimeHostCliTaskReadiness(input, now = Date.now) {
|
|
24
24
|
const checkedAt = now();
|
|
@@ -70,7 +70,6 @@ function catalogEntryAsLlmConnection(entry, catalog) {
|
|
|
70
70
|
enabledModelIds: [...entry.enabledModelIds],
|
|
71
71
|
models: [...entry.models],
|
|
72
72
|
...(entry.modelSource ? { modelSource: entry.modelSource } : {}),
|
|
73
|
-
...(entry.modelsFetchedAt ? { modelsFetchedAt: entry.modelsFetchedAt } : {}),
|
|
74
73
|
...(entry.lastTest
|
|
75
74
|
? { lastTestStatus: entry.lastTest.status, lastTestAt: entry.lastTest.checkedAt }
|
|
76
75
|
: {}),
|
|
@@ -81,7 +80,7 @@ function catalogEntryAsLlmConnection(entry, catalog) {
|
|
|
81
80
|
async function readHasSecret(connection, entry) {
|
|
82
81
|
if (!providerAuthRequiresSecret(entry.providerType))
|
|
83
82
|
return false;
|
|
84
|
-
const authKind =
|
|
83
|
+
const authKind = PROVIDER_REGISTRY[entry.providerType].authKind;
|
|
85
84
|
const kind = authKind === 'oauth_token' ? 'oauth_token' : 'api_key';
|
|
86
85
|
try {
|
|
87
86
|
const result = await connection.request('credential.vault.query', {
|
|
@@ -67,10 +67,10 @@ export async function runRuntimeHostTui(input) {
|
|
|
67
67
|
choice.connectionSlug === context.connectionSlug)
|
|
68
68
|
.map((choice) => choice.model),
|
|
69
69
|
modelChoices: context.modelChoices,
|
|
70
|
+
subscribeModelCatalogChanges: context.subscribeModelCatalogChanges,
|
|
70
71
|
connectionSlug: context.connectionSlug,
|
|
71
72
|
connectionId: context.connectionId,
|
|
72
73
|
connectionIdentities: context.connectionIdentities,
|
|
73
|
-
providerType: context.providerType,
|
|
74
74
|
modelContextWindow: context.modelContextWindow,
|
|
75
75
|
permissionMode: context.prospectivePermissionMode,
|
|
76
76
|
turnActivity: context.turnActivity,
|
|
@@ -22,7 +22,7 @@ import { createGenesisExecutionBoundary, executionBoundaryDisplayMode, } from '@
|
|
|
22
22
|
import { findProjectByIdentity } from '@maka/core/project';
|
|
23
23
|
import { SessionActivityRegistry } from '@maka/runtime/goal-turn-lifecycle';
|
|
24
24
|
import { acquireProcessLifetimeOwner, } from '@maka/storage/process-lifetime-owner';
|
|
25
|
-
import { readRuntimeHostAgentGraphEpochs, readRuntimeHostInvocableSkills, readRuntimeHostProjects, isRuntimeHostReconnectingConnection, } from '@maka/runtime-host/client';
|
|
25
|
+
import { readRuntimeHostAgentGraphEpochs, readRuntimeHostConnectionCatalog, readRuntimeHostInvocableSkills, readRuntimeHostProjects, isRuntimeHostReconnectingConnection, } from '@maka/runtime-host/client';
|
|
26
26
|
import { runtimeHostProfileUsesHostWorkspace } from '@maka/runtime-host/profile-kind';
|
|
27
27
|
import { connectRuntimeHostCli, readHostChatDefaultPermissionMode, resolveRuntimeHostCliTarget, } from './runtime-host-cli-context.js';
|
|
28
28
|
import { createRuntimeHostMakaSessionDriver, } from './runtime-host-session-driver.js';
|
|
@@ -94,7 +94,13 @@ export async function createRuntimeHostTuiContext(input) {
|
|
|
94
94
|
}),
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
|
-
|
|
97
|
+
// From the Host-resolved choice, not the connection's stored rows: a
|
|
98
|
+
// fallback or provider-default model exists only in the resolved catalog,
|
|
99
|
+
// so reading `models` left the very first status line and its diagnostics
|
|
100
|
+
// without a denominator until some later transition happened to refresh
|
|
101
|
+
// it. Every later read of this value already comes from `modelChoices`.
|
|
102
|
+
const modelContextWindow = modelChoices.find((choice) => choice.connectionSlug === selectedTarget.connectionSlug &&
|
|
103
|
+
choice.model === selectedTarget.model)?.contextWindow;
|
|
98
104
|
return {
|
|
99
105
|
connection,
|
|
100
106
|
driver,
|
|
@@ -105,12 +111,19 @@ export async function createRuntimeHostTuiContext(input) {
|
|
|
105
111
|
: { connectionId: selectedTarget.connectionId }),
|
|
106
112
|
connectionIdentities: projectRuntimeHostConnectionIdentities(catalog),
|
|
107
113
|
connectionName: selectedTarget.connection?.name ?? selectedTarget.connectionSlug,
|
|
108
|
-
...(selectedTarget.connection
|
|
109
|
-
? { providerType: selectedTarget.connection.providerType }
|
|
110
|
-
: {}),
|
|
111
114
|
model: selectedTarget.model,
|
|
112
115
|
...(modelContextWindow === undefined ? {} : { modelContextWindow }),
|
|
113
116
|
modelChoices,
|
|
117
|
+
subscribeModelCatalogChanges: (listener) => connection.subscribeConnectionCatalogChanges(() => {
|
|
118
|
+
void readRuntimeHostConnectionCatalog(connection)
|
|
119
|
+
.then((refreshed) => listener({
|
|
120
|
+
modelChoices: projectRuntimeHostModelChoices(refreshed),
|
|
121
|
+
connectionIdentities: projectRuntimeHostConnectionIdentities(refreshed),
|
|
122
|
+
}))
|
|
123
|
+
// A catalog that will not read leaves the choices the TUI already
|
|
124
|
+
// has. The Host announces again the next time it changes.
|
|
125
|
+
.catch(() => undefined);
|
|
126
|
+
}),
|
|
114
127
|
prospectivePermissionMode,
|
|
115
128
|
turnActivity: createHostOwnedTurnActivity(),
|
|
116
129
|
listSkills: (cwd) => listStablePresentedSkills(connection, driver.getSessionId(), workspace ??
|