agent-transport-system 0.7.49 → 0.7.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ats-dev.js +2 -2
- package/dist/ats.js +102 -116
- package/dist/ats.js.map +1 -1
- package/dist/{base-url-CT4Hugox.js → base-url-Cuza4k9w.js} +2 -2
- package/dist/{base-url-CT4Hugox.js.map → base-url-Cuza4k9w.js.map} +1 -1
- package/dist/{daemon-runtime-lease-C-1gNOFL.js → daemon-runtime-lease-DGexMALq.js} +1 -1
- package/dist/{lock-CYlR3Czx.js → lock-Dvj4X1DR.js} +51 -3
- package/dist/lock-Dvj4X1DR.js.map +1 -0
- package/package.json +1 -1
- package/dist/lock-CYlR3Czx.js.map +0 -1
package/dist/ats-dev.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import "./lock-
|
|
4
|
-
import { t as DEV_LOCAL_GATEWAY_BASE_URL } from "./base-url-
|
|
3
|
+
import "./lock-Dvj4X1DR.js";
|
|
4
|
+
import { t as DEV_LOCAL_GATEWAY_BASE_URL } from "./base-url-Cuza4k9w.js";
|
|
5
5
|
|
|
6
6
|
//#region src/ats-dev.ts
|
|
7
7
|
const LOCAL_GATEWAY_URL = DEV_LOCAL_GATEWAY_BASE_URL;
|
package/dist/ats.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { $ as formatLocalSetupActionLabel, $n as
|
|
3
|
+
import { $ as formatLocalSetupActionLabel, $n as atsdTaskResultPayloadSchema, $t as setLocalRuntimeDisplayNameBodySchema, A as continuitySchema, An as AGENT_REPLYING_PURPOSE, Ar as parseOptionalClientMessageId, At as notifyAgentProfileRouteCatalogChangedResponseSchema, B as daemonRouteCatalogCacheSchema, Bn as LEGACY_RUNTIME_DISPATCH_POLICY, Bt as postSpaceThreadSignalBodySchema, C as agentExecutionReadinessRouteParamsSchema, Cn as submitRuntimeRegistrationResponseSchema, Cr as getSpaceMessageAddressingRelationSupportForTargetKind, Ct as listSpaceThreadSignalsResponseSchema, D as atsdControlPlaneRequestSchema, Dn as writeSetupTokenLocalRuntimeObservedMetadataBodySchema, Dr as normalizeOptionalWorkingDirectory, Dt as normalizeListSignalsReadQuerySemantics, E as atsRequestContextSchema, En as writeCurrentDeviceObservedMetadataResponseSchema, Er as normalizeMessageEnvelope, Et as localRuntimesResponseSchema, F as createSpaceThreadBodySchema, Fn as CURRENT_DAEMON_EXECUTION_CONTRACT_EPOCH, Fr as resolveSpaceMentionLabels, Ft as patchStartSessionBodySchema, G as ensureAgentProfilePrimaryBindingBodySchema, Gn as SPACE_MEMBER_REMOVE_NOTICE_PURPOSE, Gt as projectSpaceDispatchTraceFinalVisibleOutcome, H as daemonRuntimeLeaseSchema, Hn as MAX_SIGNAL_REPLY_TO_PREVIEW_LENGTH, Ht as prepareSessionResponseSchema, I as createSpaceThreadResponseSchema, In as DAEMON_HUB_SCHEMA_VERSION, It as postNormalMessageBodySchema, J as forgetComputerResponseSchema, Jn as SPACE_UPDATES_MAX_LIMIT, Jt as resolveSpaceDispatchTraceRootCause, K as ensureAgentProfilePrimaryBindingResponseSchema, Kn as SPACE_MENTION_REJECT_NOTICE_PURPOSE, Kt as providerDispatchRuntimeContextSchema, L as createStartSessionBodySchema, Ln as DISPATCH_ACTIVITY_DISPATCHING_PURPOSE, Lt as postNormalMessageResponseSchema, M as createSpaceDiagnosticReportBodySchema, Mn as AGENT_REPLY_PREVIEW_PURPOSE, Mr as resolveBuiltinAgentControllerConversationKind, Mt as patchProfileSpaceHistoryStatusResponseSchema, N as createSpaceDiagnosticReportResponseSchema, Nn as ATSD_TASK_RESULT_SCHEMA_VERSION, Nr as resolveMessageEnvelopeTargetField, Nt as patchSpaceContractBodySchema, O as atsdControlPlaneResponseSchema, On as writeSetupTokenLocalRuntimeObservedMetadataResponseSchema, Or as normalizeSpacePasswordText, Ot as normalizeSpaceCursorPatch, P as createSpaceResponseSchema, Pn as CONVERSATION_CONTINUITY_WARNING_PURPOSE, Pr as resolveSingleSpaceMentionLabels, Pt as patchSpaceContractResponseSchema, Q as formatLocalSetupActionDescription, Qn as atsdTaskResultOpenClawGatewayVisibilityStatusSchema, Qt as setCurrentDeviceTargetBodySchema, R as currentDeviceTargetResponseSchema, Rn as DISPATCH_ACTIVITY_FAILED_PURPOSE, Rr as runtimeCoordinatorExecutionTokenEnvelopeSchema, Rt as postSpaceMembersBodySchema, S as accountSpaceIndexResponseSchema, Sn as submitRuntimeRegistrationBodySchema, Sr as formatCanonicalMentionLiteral, St as listSpaceThreadEventsResponseSchema, T as atsProfileIdSchema, Tn as writeCurrentDeviceObservedMetadataBodySchema, Tr as normalizeKnownBuiltinAgentControllerId, Tt as localRuntimesQuerySchema, U as deleteSpaceResponseSchema, Un as MESSAGE_MENTION_TYPE_VALUES, Ut as prepareSessionStreamServerFrameSchema, V as daemonRouteObservationResponseSchema, Vn as MAX_PROFILE_WORKING_DIRECTORY_LENGTH, Vt as postSpaceThreadSignalResponseSchema, W as dispatchBriefSchema, Wn as SPACE_MEMBER_JOIN_NOTICE_PURPOSE, Wt as projectObservabilityWakeCorrelation, X as formatLocalComponentsSummaryDescription, Xn as atsSpaceEgressActionSchema, Xt as resolveStartHandoffResponseSchema, Y as forgetCurrentComputerResponseSchema, Yn as atsRuntimeProfileIdSchema, Yt as resolveStartHandoffBodySchema, Z as formatLocalComponentsSummaryLabel, Zn as atsdTaskResultEnvelopeWriteSchema, Zt as serverErrorFrameSchema, _ as ATSD_CONTROL_PLANE_SCHEMA_VERSION, _n as structuredGuidePayloadFromInputSchema, _r as daemonHubRouteCatalogChangedFramePayloadSchema, _t as getSpaceWakeTraceWaterfallResponseSchema, a as runWithHeldLock, an as spaceMemberDirectoryEntrySchema, ar as conversationExecutionStateSchema, at as getAgentExecutionReadinessResponseSchema, b as LOCAL_COMPONENTS_SCHEMA_VERSION, bn as submitRuntimeProviderConversationProofsBodySchema, br as daemonServiceLaneSchema, bt as leaveSpaceResponseSchema, c as LEGACY_ATS_CLI_CONTEXT_ENV_KEY, cn as spaceMetaSchema, cr as daemonHubDeliveryExecutionIdentitySchema, ct as getPrepareReadinessResponseSchema, d as resolveCliContext, dn as startProfileReadinessSummarySchema, dr as daemonHubDispatchPreviewRequestSchema, dt as getSpaceDispatchResultResponseSchema, en as signalEnvelopeSchema, er as buildAgentControllerConversationRef, et as gatewayErrorCodeSchema, f as resolveCliContextId, fn as startSessionProgressSchema, fr as daemonHubDispatchRuntimeEvidenceRequestSchema, ft as getSpaceMessageDetailsResponseSchema, g as resolveMappedPublicAgentFailureReason, gn as startSessionWithTokenResponseSchema, gr as daemonHubRegisterSessionResponseSchema, gt as getSpaceWakeProgressResponseSchema, h as resolveBuiltinAgentControllerBrand, hn as startSessionSpaceChoiceResponseSchema, hr as daemonHubRegisterSessionRequestSchema, ht as getSpaceUpdatesResponseSchema, i as releaseLock, in as spaceIdentityDirectorySchema, ir as collectCanonicalMentionTextFragments, it as getAgentExecutionReadinessBatchResponseSchema, j as createSpaceBodySchema, jn as AGENT_REPLY_PREVIEW_END_PURPOSE, jr as profileWorkspaceModeSchema, jt as observabilityWakeTraceSelectorSchema, k as catchupResponseSchema, kn as AGENT_REPLYING_END_PURPOSE, kr as parseAgentControllerRef$1, kt as notifyAgentProfileRouteCatalogChangedBodySchema, l as listCliContextStates, ln as spaceViewerMembershipResponseSchema, lr as daemonHubDispatchLifecycleRequestSchema, lt as getSpaceContractResponseSchema, m as CODEX_UPGRADE_REQUIRED_REASON, mn as startSessionSpaceChoiceBodySchema, mr as daemonHubHeartbeatResponseSchema, mt as getSpaceThreadResponseSchema, n as isAtsLockError, nn as spaceCreatorSchema, nr as canonicalizeAgentControllerRef, nt as getActiveSpaceWakeProgressResponseSchema, o as tryCleanupStaleLock, on as spaceMemberDirectorySchema, or as createDaemonRouteObservationSummary, ot as getAgentProfilePrimaryBindingResponseSchema, p as writeCliContextState, pn as startSessionResponseSchema, pr as daemonHubHeartbeatRequestSchema, pt as getSpaceStatusResponseSchema, q as entryBriefSchema, qn as SPACE_PASSWORD_MIN_LENGTH, qt as removeSpaceMembersResponseSchema, r as readLockMeta, rn as spaceDispatchTraceResponseSchema, rr as canonicalizeBuiltinAgentControllerRef, rt as getAgentExecutionReadinessBatchBodySchema, s as ATS_CLI_CONTEXT_ENV_KEY, sn as spaceMembersSnapshotSchema, sr as daemonHubDeliverDispatchRequestSchema, st as getPrepareReadinessQuerySchema, t as acquireLock, tn as spaceBootstrapResponseSchema, tr as buildAgentControllerRoutingKey, tt as gatewayErrorEnvelopeSchema, u as readCliContextState, un as startDeviceProjectionSchema, ur as daemonHubDispatchPreviewEndRequestSchema, ut as getSpaceDispatchLookupResponseSchema, v as DAEMON_ROUTE_CATALOG_CACHE_SCHEMA_NAME, vn as submitRuntimeAgentControllerReportsBodySchema, vr as daemonHubSubmitTaskResultRequestSchema, vt as incomingServerMessageSchema, w as agentProfileBindingRouteParamsSchema, wn as upsertProfileSpaceHistoryResponseSchema, wr as normalizeBuiltinAgentControllerId, wt as listSpaceThreadsResponseSchema, x as SPACE_DISPATCH_TRACE_PROMPT_PREVIEW_MAX_CHARS, xn as submitRuntimeProviderConversationProofsResponseSchema, xr as daemonStreamFrameSchema, xt as listProfileSpaceHistoryResponseSchema, y as DAEMON_ROUTE_CATALOG_CACHE_SCHEMA_VERSION, yn as submitRuntimeAgentControllerReportsResponseSchema, yr as daemonServiceContractSchema, yt as installedLocalComponentsSnapshotSchema, z as currentLocalRuntimeReplyReadinessResponseSchema, zn as DISPATCH_ACTIVITY_RETRYING_PURPOSE, zr as sanitizeSignalTextPreview, zt as postSpaceMembersResponseSchema } from "./lock-Dvj4X1DR.js";
|
|
4
4
|
import { A as runtimeDir, C as normalizeAtsProfileId, D as resolveAtsEnvPreset, E as resolveAtsCliEntryNameFromArgv, F as systemDir, N as skillsDir, O as resolveAtsRootDir, P as spacesDir, S as normalizeAccountKey, T as profileViewPath, a as accountProfileWorkspacePath, c as atsRootDir, d as deviceOpenClawProfileBootstrapPath, f as deviceOpenClawProfileDir, i as accountProfileViewPath, j as runtimeLogsDir, k as resolveDefaultAtsHomeDirname, n as accountProfileLocalMetaPath, o as accountsDir, p as deviceOpenClawProfileWorkspaceDir, r as accountProfileSpaceCacheDir, s as atsBackupsDir, t as ATS_HOME_ENV_KEY, w as profileDir, y as legacyAccountProfileSpacesDir } from "./paths-DFiopT5Y.js";
|
|
5
|
-
import { A as toSpaceDeleteUrl, B as toSpaceUpdatesUrl, C as updateConfiguredSkillsConfig, D as toSpaceContractUrl, E as toDaemonRouteObservationUrl, F as toSpaceMetaUrl, I as toSpacePasswordUrl, L as toSpaceRemoveMembersUrl, M as toSpaceDispatchTraceUrl, N as toSpaceLeaveUrl, O as toSpaceCreateUrl, P as toSpaceMembersUrl, R as toSpaceResultUrl, S as updateConfiguredOnboardingConfig, T as normalizeBaseUrl, V as toSpaceWsUrl, _ as getRuntimeConfigReadHealth, a as resolveBaseUrlOrNull, b as setConfiguredSkillsConfig, c as DEFAULT_RUNTIME_AGENT_TRANSPORT_MODE, d as getConfiguredDaemonDispatchLimits, f as getConfiguredDeviceRuntimeState, g as getConfiguredViewCustomization, h as getConfiguredStartV1OnboardingState, i as resolveBaseUrl, j as toSpaceDispatchLookupUrl, k as toSpaceCursorUrl, l as alignRuntimeConfigStorage, m as getConfiguredSkillsConfig, n as normalizeGatewayBaseUrl, o as resolveDefaultGatewayBaseUrl, p as getConfiguredOnboardingDisclaimerAcceptedAt, r as normalizeGatewayBaseUrlOrNull, s as resolveExplicitGatewayUrlOrThrow, u as createDefaultRuntimeAgentControllerSettings, v as resolveRuntimeSkillsCustomTargetId, w as updateConfiguredStartV1OnboardingState, x as updateConfiguredDeviceRuntimeState, y as setConfiguredBaseUrl, z as toSpaceSignalsUrl } from "./base-url-
|
|
5
|
+
import { A as toSpaceDeleteUrl, B as toSpaceUpdatesUrl, C as updateConfiguredSkillsConfig, D as toSpaceContractUrl, E as toDaemonRouteObservationUrl, F as toSpaceMetaUrl, I as toSpacePasswordUrl, L as toSpaceRemoveMembersUrl, M as toSpaceDispatchTraceUrl, N as toSpaceLeaveUrl, O as toSpaceCreateUrl, P as toSpaceMembersUrl, R as toSpaceResultUrl, S as updateConfiguredOnboardingConfig, T as normalizeBaseUrl, V as toSpaceWsUrl, _ as getRuntimeConfigReadHealth, a as resolveBaseUrlOrNull, b as setConfiguredSkillsConfig, c as DEFAULT_RUNTIME_AGENT_TRANSPORT_MODE, d as getConfiguredDaemonDispatchLimits, f as getConfiguredDeviceRuntimeState, g as getConfiguredViewCustomization, h as getConfiguredStartV1OnboardingState, i as resolveBaseUrl, j as toSpaceDispatchLookupUrl, k as toSpaceCursorUrl, l as alignRuntimeConfigStorage, m as getConfiguredSkillsConfig, n as normalizeGatewayBaseUrl, o as resolveDefaultGatewayBaseUrl, p as getConfiguredOnboardingDisclaimerAcceptedAt, r as normalizeGatewayBaseUrlOrNull, s as resolveExplicitGatewayUrlOrThrow, u as createDefaultRuntimeAgentControllerSettings, v as resolveRuntimeSkillsCustomTargetId, w as updateConfiguredStartV1OnboardingState, x as updateConfiguredDeviceRuntimeState, y as setConfiguredBaseUrl, z as toSpaceSignalsUrl } from "./base-url-Cuza4k9w.js";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import { Command, Option } from "commander";
|
|
8
8
|
import { accessSync, appendFileSync, chmodSync, constants, existsSync, mkdirSync, readFileSync, realpathSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
@@ -27,7 +27,7 @@ import wrapAnsi from "wrap-ansi";
|
|
|
27
27
|
import { Box, Container, Editor, Key, ProcessTerminal, TUI, Text, getEditorKeybindings, matchesKey } from "@mariozechner/pi-tui";
|
|
28
28
|
|
|
29
29
|
//#region package.json
|
|
30
|
-
var version = "0.7.
|
|
30
|
+
var version = "0.7.51";
|
|
31
31
|
var package_default = {
|
|
32
32
|
$schema: "https://www.schemastore.org/package.json",
|
|
33
33
|
name: "agent-transport-system",
|
|
@@ -12515,7 +12515,7 @@ function normalizeDispatchPostMessageAction(input) {
|
|
|
12515
12515
|
activationTargetsCount: canonicalAction.messageEnvelope.activationTargets.length,
|
|
12516
12516
|
ccTargetsCount: canonicalAction.messageEnvelope.ccTargets.length,
|
|
12517
12517
|
inputKind: input.inputKind,
|
|
12518
|
-
|
|
12518
|
+
memberDirectoryLoaded: input.sendTargetReference.status === "loaded",
|
|
12519
12519
|
referenceTargetsCount: canonicalAction.messageEnvelope.referenceTargets.length,
|
|
12520
12520
|
replyToSignalIdResolved: Boolean(canonicalAction.messageEnvelope.replyToSignalId)
|
|
12521
12521
|
}
|
|
@@ -12532,7 +12532,7 @@ function normalizeReplyToSignalId$1(input) {
|
|
|
12532
12532
|
function validateDispatchPostMessageTargets(input) {
|
|
12533
12533
|
const { activationTargets, ccTargets, referenceTargets } = input.action.messageEnvelope;
|
|
12534
12534
|
if (activationTargets.length === 0 && referenceTargets.length === 0 && ccTargets.length === 0) return;
|
|
12535
|
-
if (input.sendTargetReference.status !== "loaded") throw new Error("post_message.messageEnvelope targets require a current
|
|
12535
|
+
if (input.sendTargetReference.status !== "loaded") throw new Error("post_message.messageEnvelope targets require a current Space member directory");
|
|
12536
12536
|
const targetByProfileId = new Map(input.sendTargetReference.projection.map((target) => [target.profileId, target]));
|
|
12537
12537
|
for (const rule of TARGET_VALIDATION_RULES) {
|
|
12538
12538
|
const targets = input.action.messageEnvelope[rule.fieldName];
|
|
@@ -12550,7 +12550,6 @@ function validateDispatchTargetProfileId(input) {
|
|
|
12550
12550
|
const fieldPath = `post_message.messageEnvelope.${input.fieldName}[${String(input.index)}]`;
|
|
12551
12551
|
if (!target) throw new Error(`${fieldPath} must reference an active profile in this space`);
|
|
12552
12552
|
if (input.relationName === "wake" && !target.allowedRelations.wake) throw new Error(`${fieldPath} must reference an agent profile in this space`);
|
|
12553
|
-
if (input.relationName === "wake" && target.wakeAvailability.status !== "ready") throw new Error(`${fieldPath} must reference an agent profile available for Wake`);
|
|
12554
12553
|
if ((input.relationName === "reference" || input.relationName === "cc") && !target.allowedRelations[input.relationName]) throw new Error(`${fieldPath} must reference an active profile in this space`);
|
|
12555
12554
|
}
|
|
12556
12555
|
|
|
@@ -12656,10 +12655,10 @@ const SPACE_ACTION_TARGET_GUIDANCE_LINES = [
|
|
|
12656
12655
|
"For fallback ats-space-action blocks, target semantics only count when they are written in post_message.messageEnvelope.",
|
|
12657
12656
|
"Any @name text in the body is only prose in the agent path; it does not define ATS targets.",
|
|
12658
12657
|
"activationTargets is only for waking another Agent Profile in this Space.",
|
|
12659
|
-
"activationTargets must reference an Agent Profile
|
|
12658
|
+
"activationTargets must reference an active Agent Profile member in this Space.",
|
|
12660
12659
|
"Never put a Human Profile ID, sender ID, or reply recipient in activationTargets.",
|
|
12661
12660
|
"For a normal reply to the current Wake, leave activationTargets, referenceTargets, and ccTargets empty.",
|
|
12662
|
-
"Fallback ats-space-action
|
|
12661
|
+
"Fallback ats-space-action target arrays must contain profileId strings, not objects. Example: {\"activationTargets\":[\"agt_11111111-1111-4111-8111-111111111111\"],\"referenceTargets\":[\"11111111-1111-4111-8111-111111111111\"],\"ccTargets\":[]}."
|
|
12663
12662
|
];
|
|
12664
12663
|
|
|
12665
12664
|
//#endregion
|
|
@@ -12873,7 +12872,7 @@ async function setDaemonServiceRuntimeState(state, pathInput = {}) {
|
|
|
12873
12872
|
await writeDaemonServiceRuntimeState(state, pathInput);
|
|
12874
12873
|
}
|
|
12875
12874
|
async function clearDaemonServiceRuntimeState(pathInput = {}) {
|
|
12876
|
-
const { clearDaemonRuntimeLease } = await import("./daemon-runtime-lease-
|
|
12875
|
+
const { clearDaemonRuntimeLease } = await import("./daemon-runtime-lease-DGexMALq.js");
|
|
12877
12876
|
await Promise.all([rm(daemonServiceRuntimeStatePath(pathInput), { force: true }), clearDaemonRuntimeLease(pathInput)]);
|
|
12878
12877
|
}
|
|
12879
12878
|
async function withDaemonServiceRunLock(callback, meta = {
|
|
@@ -21663,6 +21662,9 @@ function buildSpaceBootstrapPath(spaceId) {
|
|
|
21663
21662
|
function buildSpaceMembersPath(spaceId) {
|
|
21664
21663
|
return buildSpaceRoutePath(spaceId, "members");
|
|
21665
21664
|
}
|
|
21665
|
+
function buildSpaceMemberDirectoryPath(spaceId) {
|
|
21666
|
+
return buildSpaceRoutePath(spaceId, "member-directory");
|
|
21667
|
+
}
|
|
21666
21668
|
function buildSpaceIdentityDirectoryPath(spaceId) {
|
|
21667
21669
|
return buildSpaceRoutePath(spaceId, "identity-directory");
|
|
21668
21670
|
}
|
|
@@ -21907,6 +21909,16 @@ async function getSpaceMembersSnapshot(client, input) {
|
|
|
21907
21909
|
invalidMessage: "invalid space members response"
|
|
21908
21910
|
});
|
|
21909
21911
|
}
|
|
21912
|
+
async function getSpaceMemberDirectory(client, input) {
|
|
21913
|
+
return await client.requestJson({
|
|
21914
|
+
url: buildSpaceMemberDirectoryPath(input.spaceId),
|
|
21915
|
+
operation: "space.member_directory.read",
|
|
21916
|
+
requestContext: input.requestContext,
|
|
21917
|
+
...input.spacePassword === void 0 ? {} : { spacePassword: input.spacePassword },
|
|
21918
|
+
schema: spaceMemberDirectorySchema,
|
|
21919
|
+
invalidMessage: "invalid space member directory response"
|
|
21920
|
+
});
|
|
21921
|
+
}
|
|
21910
21922
|
async function getSpaceIdentityDirectory(client, input) {
|
|
21911
21923
|
return await client.requestJson({
|
|
21912
21924
|
url: buildSpaceIdentityDirectoryPath(input.spaceId),
|
|
@@ -22132,6 +22144,7 @@ const createSpaceApi = (client) => {
|
|
|
22132
22144
|
getBootstrap: async (input) => await getSpaceBootstrap(client, input),
|
|
22133
22145
|
getStatus: async (input) => await getSpaceStatus(client, input),
|
|
22134
22146
|
getMembersSnapshot: async (input) => await getSpaceMembersSnapshot(client, input),
|
|
22147
|
+
getMemberDirectory: async (input) => await getSpaceMemberDirectory(client, input),
|
|
22135
22148
|
getIdentityDirectory: async (input) => await getSpaceIdentityDirectory(client, input),
|
|
22136
22149
|
getViewerMembership: async (input) => await getSpaceViewerMembership(client, input),
|
|
22137
22150
|
listSignals: async (input) => await listSpaceSignals(client, input),
|
|
@@ -32794,7 +32807,7 @@ function createSpaceTargetCatalog(snapshot) {
|
|
|
32794
32807
|
memberInput,
|
|
32795
32808
|
ownerProfileNameByOwnerUserId
|
|
32796
32809
|
}));
|
|
32797
|
-
const lookupTokenCounts = buildLookupTokenCounts(projectableTargets, { labelByProfileId });
|
|
32810
|
+
const lookupTokenCounts = buildLookupTokenCounts$1(projectableTargets, { labelByProfileId });
|
|
32798
32811
|
const entries = projectableTargets.map((target) => buildCatalogEntry({
|
|
32799
32812
|
labelByProfileId,
|
|
32800
32813
|
lookupTokenCounts,
|
|
@@ -32824,7 +32837,7 @@ function buildCatalogEntry(input) {
|
|
|
32824
32837
|
exactMentionLabels: mentionLabels.exactMentionLabels,
|
|
32825
32838
|
labelSource: mentionLabels.labelSource,
|
|
32826
32839
|
liveNow: input.target.liveNow,
|
|
32827
|
-
lookupTokens: buildLookupTokens({
|
|
32840
|
+
lookupTokens: buildLookupTokens$1({
|
|
32828
32841
|
exactMentionLabels: mentionLabels.exactMentionLabels,
|
|
32829
32842
|
mentionAlias: input.target.mentionAlias,
|
|
32830
32843
|
profileId: input.target.profileId,
|
|
@@ -32834,7 +32847,7 @@ function buildCatalogEntry(input) {
|
|
|
32834
32847
|
ownerDisplay: input.target.ownerDisplay,
|
|
32835
32848
|
ownerName: input.target.ownerName,
|
|
32836
32849
|
ownerUserId: input.target.ownerUserId,
|
|
32837
|
-
preferredLookupToken: resolvePreferredLookupToken({
|
|
32850
|
+
preferredLookupToken: resolvePreferredLookupToken$1({
|
|
32838
32851
|
exactMentionLabels: mentionLabels.exactMentionLabels,
|
|
32839
32852
|
lookupTokenCounts: input.lookupTokenCounts,
|
|
32840
32853
|
profileId: input.target.profileId,
|
|
@@ -32854,7 +32867,7 @@ function buildProjectableTarget(input) {
|
|
|
32854
32867
|
const profileKind = resolveCatalogMemberProfileKind(input.memberInput);
|
|
32855
32868
|
const agentMember = input.memberInput.expectedProfileKind === "agent" ? input.memberInput.member : null;
|
|
32856
32869
|
const profileId = parseRuntimeProfileId(member.profileId);
|
|
32857
|
-
const profileIdShort = buildProfileIdShort(profileId);
|
|
32870
|
+
const profileIdShort = buildProfileIdShort$1(profileId);
|
|
32858
32871
|
const ownerName = normalizeOptionalText$7$1(member.ownerName);
|
|
32859
32872
|
const ownerUserId = normalizeOptionalText$7$1(member.ownerUserId);
|
|
32860
32873
|
return {
|
|
@@ -32954,32 +32967,32 @@ function buildLookupTokenMap(entries) {
|
|
|
32954
32967
|
}
|
|
32955
32968
|
return byLookupToken;
|
|
32956
32969
|
}
|
|
32957
|
-
function buildLookupTokens(input) {
|
|
32970
|
+
function buildLookupTokens$1(input) {
|
|
32958
32971
|
const tokens = /* @__PURE__ */ new Set();
|
|
32959
|
-
addLookupToken(tokens, input.profileId);
|
|
32960
|
-
addLookupToken(tokens, input.profileName);
|
|
32961
|
-
addLookupToken(tokens, input.mentionAlias);
|
|
32962
|
-
for (const exactMentionLabel of input.exactMentionLabels) addLookupToken(tokens, exactMentionLabel);
|
|
32972
|
+
addLookupToken$1(tokens, input.profileId);
|
|
32973
|
+
addLookupToken$1(tokens, input.profileName);
|
|
32974
|
+
addLookupToken$1(tokens, input.mentionAlias);
|
|
32975
|
+
for (const exactMentionLabel of input.exactMentionLabels) addLookupToken$1(tokens, exactMentionLabel);
|
|
32963
32976
|
return [...tokens];
|
|
32964
32977
|
}
|
|
32965
|
-
function buildLookupTokenCounts(targets, input) {
|
|
32978
|
+
function buildLookupTokenCounts$1(targets, input) {
|
|
32966
32979
|
const counts = /* @__PURE__ */ new Map();
|
|
32967
32980
|
for (const target of targets) {
|
|
32968
32981
|
const mentionLabels = input.labelByProfileId.get(target.profileId);
|
|
32969
32982
|
if (!mentionLabels) continue;
|
|
32970
32983
|
const uniqueLookupTokens = /* @__PURE__ */ new Set();
|
|
32971
|
-
addLookupToken(uniqueLookupTokens, target.profileId);
|
|
32972
|
-
addLookupToken(uniqueLookupTokens, target.profileName);
|
|
32973
|
-
addLookupToken(uniqueLookupTokens, target.mentionAlias);
|
|
32974
|
-
addLookupToken(uniqueLookupTokens, mentionLabels.primaryMentionLabel);
|
|
32975
|
-
for (const exactMentionLabel of mentionLabels.exactMentionLabels) addLookupToken(uniqueLookupTokens, exactMentionLabel);
|
|
32984
|
+
addLookupToken$1(uniqueLookupTokens, target.profileId);
|
|
32985
|
+
addLookupToken$1(uniqueLookupTokens, target.profileName);
|
|
32986
|
+
addLookupToken$1(uniqueLookupTokens, target.mentionAlias);
|
|
32987
|
+
addLookupToken$1(uniqueLookupTokens, mentionLabels.primaryMentionLabel);
|
|
32988
|
+
for (const exactMentionLabel of mentionLabels.exactMentionLabels) addLookupToken$1(uniqueLookupTokens, exactMentionLabel);
|
|
32976
32989
|
for (const lookupToken of uniqueLookupTokens) counts.set(lookupToken, (counts.get(lookupToken) ?? 0) + 1);
|
|
32977
32990
|
}
|
|
32978
32991
|
return counts;
|
|
32979
32992
|
}
|
|
32980
|
-
function resolvePreferredLookupToken(input) {
|
|
32993
|
+
function resolvePreferredLookupToken$1(input) {
|
|
32981
32994
|
for (const candidate of [input.exactMentionLabels[0], input.profileName]) {
|
|
32982
|
-
const normalizedCandidate = normalizeLookupToken(candidate);
|
|
32995
|
+
const normalizedCandidate = normalizeLookupToken$1(candidate);
|
|
32983
32996
|
if (normalizedCandidate && isUniquelyOwnedLookupToken(input.lookupTokenCounts, normalizedCandidate)) return normalizedCandidate;
|
|
32984
32997
|
}
|
|
32985
32998
|
return input.profileId;
|
|
@@ -32987,11 +33000,11 @@ function resolvePreferredLookupToken(input) {
|
|
|
32987
33000
|
function isUniquelyOwnedLookupToken(counts, token) {
|
|
32988
33001
|
return Boolean(token && counts.get(token) === 1);
|
|
32989
33002
|
}
|
|
32990
|
-
function addLookupToken(tokens, value) {
|
|
32991
|
-
const normalizedToken = normalizeLookupToken(value);
|
|
33003
|
+
function addLookupToken$1(tokens, value) {
|
|
33004
|
+
const normalizedToken = normalizeLookupToken$1(value);
|
|
32992
33005
|
if (normalizedToken) tokens.add(normalizedToken);
|
|
32993
33006
|
}
|
|
32994
|
-
function normalizeLookupToken(value) {
|
|
33007
|
+
function normalizeLookupToken$1(value) {
|
|
32995
33008
|
return normalizeReadableMentionLookupToken(value);
|
|
32996
33009
|
}
|
|
32997
33010
|
function buildOwnerProfileNameByOwnerUserId$1(snapshot) {
|
|
@@ -33019,7 +33032,7 @@ function resolveOwnerDisplayName(input) {
|
|
|
33019
33032
|
if (!ownerUserId) return null;
|
|
33020
33033
|
return input.ownerProfileNameByOwnerUserId.get(ownerUserId) ?? null;
|
|
33021
33034
|
}
|
|
33022
|
-
function buildProfileIdShort(profileId) {
|
|
33035
|
+
function buildProfileIdShort$1(profileId) {
|
|
33023
33036
|
if (profileId.startsWith("agt_")) return `agt_${profileId.slice(4, 9)}`;
|
|
33024
33037
|
return profileId.slice(0, 5);
|
|
33025
33038
|
}
|
|
@@ -33366,6 +33379,9 @@ function toRelationName(fieldName) {
|
|
|
33366
33379
|
default: return fieldName;
|
|
33367
33380
|
}
|
|
33368
33381
|
}
|
|
33382
|
+
function listSpaceMemberDirectorySendTargets(directory) {
|
|
33383
|
+
return [...directory.members];
|
|
33384
|
+
}
|
|
33369
33385
|
const MENTION_START_PATTERN = /[\w\\]/u;
|
|
33370
33386
|
function extractMentionAuthoringPrefix(textBeforeCursor) {
|
|
33371
33387
|
if (!textBeforeCursor) return null;
|
|
@@ -39626,11 +39642,15 @@ function parseDispatchTask(input) {
|
|
|
39626
39642
|
const mentionSourceProfileId = normalizeOptionalText$28(payload.sourceSignal.profileId) ?? normalizeOptionalText$28(payload.sourceSignalSnapshot?.profileId);
|
|
39627
39643
|
const mentionSourceProfileKind = payload.sourceSignal.profileKind ?? payload.sourceSignalSnapshot?.profileKind ?? null;
|
|
39628
39644
|
const mentionSourceProfileMentionLabel = normalizeOptionalText$28(payload.sourceSignal.profileMentionLabel) ?? normalizeOptionalText$28(payload.sourceSignalSnapshot?.profileMentionLabel);
|
|
39629
|
-
const
|
|
39645
|
+
const rawPrompt = normalizeOptionalText$28(payload.sourceSignal.text) ?? normalizeOptionalText$28(payload.sourceSignalSnapshot?.text);
|
|
39646
|
+
const sourceMessageEnvelope = payload.sourceMessageEnvelope ?? null;
|
|
39647
|
+
const prompt = resolveDispatchPrompt({
|
|
39648
|
+
rawPrompt,
|
|
39649
|
+
sourceMessageEnvelope
|
|
39650
|
+
});
|
|
39630
39651
|
const targetProfileDisplay = resolveDispatchTaskTargetProfileDisplayFacts(payload);
|
|
39631
39652
|
const spaceContext = resolveDispatchTaskSpaceContext(payload);
|
|
39632
39653
|
const triggerMode = spaceContext.spaceContractSnapshot?.dispatchPolicy.mode ?? payload.dispatchPolicy;
|
|
39633
|
-
const sourceMessageEnvelope = payload.sourceMessageEnvelope ?? null;
|
|
39634
39654
|
const recipientExplicitlyAddressedByActivationTargets = isRecipientExplicitlyAddressedByActivationTargets({
|
|
39635
39655
|
sourceMessageEnvelope,
|
|
39636
39656
|
targetProfileId: requiredFields.targetProfileId
|
|
@@ -39687,6 +39707,21 @@ function resolveDispatchTaskTargetProfileDisplayFacts(payload) {
|
|
|
39687
39707
|
targetProfileName: normalizeOptionalText$28(payload.targetProfileName) ?? null
|
|
39688
39708
|
};
|
|
39689
39709
|
}
|
|
39710
|
+
function resolveDispatchPrompt(input) {
|
|
39711
|
+
const prompt = normalizeOptionalText$28(input.rawPrompt);
|
|
39712
|
+
if (!prompt) return null;
|
|
39713
|
+
if ((input.sourceMessageEnvelope?.activationTargets.length ?? 0) === 0) return prompt;
|
|
39714
|
+
const wakeMentionFragments = collectCanonicalMentionTextFragments(prompt).filter((fragment) => fragment.parsedLiteral?.type === "wake");
|
|
39715
|
+
if (wakeMentionFragments.length === 0) return prompt;
|
|
39716
|
+
let cursor = 0;
|
|
39717
|
+
const parts = [];
|
|
39718
|
+
for (const fragment of wakeMentionFragments) {
|
|
39719
|
+
parts.push(prompt.slice(cursor, fragment.start));
|
|
39720
|
+
cursor = fragment.end;
|
|
39721
|
+
}
|
|
39722
|
+
parts.push(prompt.slice(cursor));
|
|
39723
|
+
return normalizeOptionalText$28(parts.join(" ").replace(/\s+/gu, " ")) ?? prompt;
|
|
39724
|
+
}
|
|
39690
39725
|
function resolveDispatchTaskSpaceContext(payload) {
|
|
39691
39726
|
return {
|
|
39692
39727
|
continuitySnapshot: payload.continuitySnapshot ?? null,
|
|
@@ -41222,53 +41257,9 @@ function parseSendTargetReference(value) {
|
|
|
41222
41257
|
throw new Error("Invalid ATS Space Action send target reference status.");
|
|
41223
41258
|
}
|
|
41224
41259
|
function parseSendTargetProjectionEntry(value, index) {
|
|
41225
|
-
const
|
|
41226
|
-
|
|
41227
|
-
|
|
41228
|
-
const wakeAvailability = parseWakeAvailability(record.wakeAvailability, index);
|
|
41229
|
-
return {
|
|
41230
|
-
allowedRelations: {
|
|
41231
|
-
wake: requiredBoolean(record.allowedRelations, "wake", index),
|
|
41232
|
-
reference: requiredBoolean(record.allowedRelations, "reference", index),
|
|
41233
|
-
cc: requiredBoolean(record.allowedRelations, "cc", index)
|
|
41234
|
-
},
|
|
41235
|
-
controllerDisplay: optionalString(record.controllerDisplay),
|
|
41236
|
-
agentControllerRef: optionalString(record.agentControllerRef),
|
|
41237
|
-
exactMentionLabels: parseStringArray(record.exactMentionLabels),
|
|
41238
|
-
labelSource: parseLabelSource(record.labelSource, index),
|
|
41239
|
-
liveNow: requiredProjectionBoolean(record.liveNow, "liveNow", index),
|
|
41240
|
-
lookupTokens: parseStringArray(record.lookupTokens),
|
|
41241
|
-
mentionAlias: optionalString(record.mentionAlias),
|
|
41242
|
-
ownerDisplay: optionalString(record.ownerDisplay),
|
|
41243
|
-
ownerName: optionalString(record.ownerName),
|
|
41244
|
-
ownerUserId: optionalString(record.ownerUserId),
|
|
41245
|
-
preferredLookupToken: requiredString(record.preferredLookupToken, "preferredLookupToken"),
|
|
41246
|
-
primaryMentionLabel: requiredString(record.primaryMentionLabel, "primaryMentionLabel"),
|
|
41247
|
-
profileId: requiredString(record.profileId, "profileId"),
|
|
41248
|
-
profileIdShort: requiredString(record.profileIdShort, "profileIdShort"),
|
|
41249
|
-
profileKind,
|
|
41250
|
-
profileName: requiredString(record.profileName, "profileName"),
|
|
41251
|
-
runtimeDeviceDisplayName: optionalString(record.runtimeDeviceDisplayName),
|
|
41252
|
-
wakeAvailability
|
|
41253
|
-
};
|
|
41254
|
-
}
|
|
41255
|
-
function parseWakeAvailability(value, index) {
|
|
41256
|
-
const record = toRecord$1(value, `ATS Space Action target projection entry ${index} wakeAvailability`);
|
|
41257
|
-
if (record.status === "unsupported") return {
|
|
41258
|
-
status: "unsupported",
|
|
41259
|
-
reasonCodes: [],
|
|
41260
|
-
reasonText: null
|
|
41261
|
-
};
|
|
41262
|
-
if (record.status === "ready" || record.status === "blocked") return {
|
|
41263
|
-
status: record.status,
|
|
41264
|
-
reasonCodes: parseStringArray(record.reasonCodes),
|
|
41265
|
-
reasonText: optionalString(record.reasonText)
|
|
41266
|
-
};
|
|
41267
|
-
throw new Error(`ATS Space Action target projection entry ${index} has an invalid wakeAvailability.status.`);
|
|
41268
|
-
}
|
|
41269
|
-
function parseLabelSource(value, index) {
|
|
41270
|
-
if (value === "profile_name" || value === "mention_alias" || value === "profile_name_with_short_id" || value === "profile_id") return value;
|
|
41271
|
-
throw new Error(`ATS Space Action target projection entry ${index} has an invalid labelSource.`);
|
|
41260
|
+
const parsed = spaceMemberDirectoryEntrySchema.safeParse(value);
|
|
41261
|
+
if (!parsed.success) throw new Error(`ATS Space Action target projection entry ${index} is not a valid Space member directory entry.`);
|
|
41262
|
+
return parsed.data;
|
|
41272
41263
|
}
|
|
41273
41264
|
function parseSpaceContractSnapshot(value) {
|
|
41274
41265
|
if (value === null || value === void 0) return null;
|
|
@@ -41278,15 +41269,6 @@ function parseSpaceContractSnapshot(value) {
|
|
|
41278
41269
|
publicationMode: record.publicationMode === "raw_context_sharing" ? "raw_context_sharing" : "collaboration"
|
|
41279
41270
|
};
|
|
41280
41271
|
}
|
|
41281
|
-
function requiredBoolean(value, fieldName, index) {
|
|
41282
|
-
const fieldValue = toRecord$1(value, `ATS Space Action target projection entry ${index} allowedRelations`)[fieldName];
|
|
41283
|
-
if (typeof fieldValue !== "boolean") throw new Error(`ATS Space Action target projection entry ${index} allowedRelations.${fieldName} must be a boolean.`);
|
|
41284
|
-
return fieldValue;
|
|
41285
|
-
}
|
|
41286
|
-
function requiredProjectionBoolean(value, fieldName, index) {
|
|
41287
|
-
if (typeof value !== "boolean") throw new Error(`ATS Space Action target projection entry ${index}.${fieldName} must be a boolean.`);
|
|
41288
|
-
return value;
|
|
41289
|
-
}
|
|
41290
41272
|
function assertContextActive(context, nowMs) {
|
|
41291
41273
|
if (nowMs > context.expiresAtMs) throw new Error("The ATS Space Action dispatch context has expired.");
|
|
41292
41274
|
}
|
|
@@ -41644,7 +41626,7 @@ async function resolveDispatchSendTargetReference(input) {
|
|
|
41644
41626
|
});
|
|
41645
41627
|
const accessRequestContext = getSpaceAccessRequestContext(spaceAccess);
|
|
41646
41628
|
const spacePassword = getSpaceAccessPassword(spaceAccess);
|
|
41647
|
-
const projection =
|
|
41629
|
+
const projection = listSpaceMemberDirectorySendTargets(await spaceApi.getMemberDirectory({
|
|
41648
41630
|
spaceId: spaceAccess.spaceId,
|
|
41649
41631
|
requestContext: accessRequestContext ?? requestContext,
|
|
41650
41632
|
...spacePassword ? { spacePassword } : {}
|
|
@@ -41657,7 +41639,7 @@ async function resolveDispatchSendTargetReference(input) {
|
|
|
41657
41639
|
} catch (error) {
|
|
41658
41640
|
return {
|
|
41659
41641
|
status: "failed",
|
|
41660
|
-
errorMessage: error instanceof Error ? error.message : "Failed to load current
|
|
41642
|
+
errorMessage: error instanceof Error ? error.message : "Failed to load current Space member directory",
|
|
41661
41643
|
projection: null,
|
|
41662
41644
|
referenceLines: []
|
|
41663
41645
|
};
|
|
@@ -41677,7 +41659,7 @@ function formatDispatchSendTargetReferenceLine(target) {
|
|
|
41677
41659
|
}
|
|
41678
41660
|
function formatAllowedRelations(target) {
|
|
41679
41661
|
const relations = [];
|
|
41680
|
-
if (target.allowedRelations.wake) relations.push(
|
|
41662
|
+
if (target.allowedRelations.wake) relations.push("wake");
|
|
41681
41663
|
if (target.allowedRelations.reference) relations.push("reference");
|
|
41682
41664
|
if (target.allowedRelations.cc) relations.push("cc");
|
|
41683
41665
|
return relations.join(" | ");
|
|
@@ -43549,7 +43531,7 @@ function normalizeResolvedPostMessageAction(input) {
|
|
|
43549
43531
|
runtimeResult: input.runtimeResult,
|
|
43550
43532
|
structuredSpaceActionResolution: input.structuredSpaceActionResolution
|
|
43551
43533
|
}),
|
|
43552
|
-
|
|
43534
|
+
memberDirectoryLoaded: input.sendTargetReference.status === "loaded",
|
|
43553
43535
|
referenceTargetsCount: action.messageEnvelope.referenceTargets.length,
|
|
43554
43536
|
replyToSignalIdResolved: Boolean(action.messageEnvelope.replyToSignalId),
|
|
43555
43537
|
targetProfileId: input.parsedTask.targetProfileId,
|
|
@@ -45364,6 +45346,7 @@ async function runDaemonSocketSession(input) {
|
|
|
45364
45346
|
let closeCode = 1e3;
|
|
45365
45347
|
let closeReason = "closed";
|
|
45366
45348
|
let heartbeatInFlight = false;
|
|
45349
|
+
let routeCatalogSyncInFlight = false;
|
|
45367
45350
|
let heartbeatTimer = null;
|
|
45368
45351
|
let heartbeatTimerDueAtMs = null;
|
|
45369
45352
|
let lastDispatchActivityAtMs = null;
|
|
@@ -45533,7 +45516,7 @@ async function runDaemonSocketSession(input) {
|
|
|
45533
45516
|
nextCatalogSyncAtMs = 0;
|
|
45534
45517
|
nextProviderConversationProofSyncAtMs = 0;
|
|
45535
45518
|
nextRuntimeAgentControllerReportSyncAtMs = 0;
|
|
45536
|
-
if (heartbeatInFlight) pendingLocalExecutionEvidenceRefreshReason = inputRequest.reason;
|
|
45519
|
+
if (heartbeatInFlight || routeCatalogSyncInFlight) pendingLocalExecutionEvidenceRefreshReason = inputRequest.reason;
|
|
45537
45520
|
scheduleHeartbeat({
|
|
45538
45521
|
delayMs: 0,
|
|
45539
45522
|
reason: inputRequest.scheduleReason
|
|
@@ -45574,7 +45557,6 @@ async function runDaemonSocketSession(input) {
|
|
|
45574
45557
|
if (closed || heartbeatInFlight) return;
|
|
45575
45558
|
heartbeatInFlight = true;
|
|
45576
45559
|
try {
|
|
45577
|
-
await syncRouteCatalogIfDue();
|
|
45578
45560
|
const leases = Array.from(leasesByProfileId.entries()).map(([profileId, leaseEpoch]) => ({
|
|
45579
45561
|
profileId,
|
|
45580
45562
|
leaseEpoch
|
|
@@ -45610,7 +45592,6 @@ async function runDaemonSocketSession(input) {
|
|
|
45610
45592
|
if (heartbeatResponse.staleLeases.length > 0) {
|
|
45611
45593
|
forceCatalogSyncReason = "stale_leases";
|
|
45612
45594
|
nextCatalogSyncAtMs = 0;
|
|
45613
|
-
await syncRouteCatalogIfDue();
|
|
45614
45595
|
}
|
|
45615
45596
|
await input.touchRuntimeState({
|
|
45616
45597
|
heartbeatAt: nowIsoString(),
|
|
@@ -45644,6 +45625,7 @@ async function runDaemonSocketSession(input) {
|
|
|
45644
45625
|
code: "daemon.run.heartbeat",
|
|
45645
45626
|
text: `heartbeat ok; active leases=${leasesByProfileId.size}, stale leases=${heartbeatResponse.staleLeases.length}, next=${String(currentHeartbeatIntervalMs)}ms`
|
|
45646
45627
|
});
|
|
45628
|
+
startRouteCatalogSyncIfDue();
|
|
45647
45629
|
startSupplementalEvidenceSyncs();
|
|
45648
45630
|
} catch (error) {
|
|
45649
45631
|
consecutiveHeartbeatFailures += 1;
|
|
@@ -45925,7 +45907,23 @@ async function runDaemonSocketSession(input) {
|
|
|
45925
45907
|
handleFailedCatalogSync(syncResult);
|
|
45926
45908
|
resolvePendingRouteCatalogSyncRequests(syncResult);
|
|
45927
45909
|
};
|
|
45928
|
-
const
|
|
45910
|
+
const shouldStartRouteCatalogSync = () => Boolean(forceCatalogSyncReason) || Date.now() >= nextCatalogSyncAtMs;
|
|
45911
|
+
function startRouteCatalogSyncIfDue() {
|
|
45912
|
+
if (closed || routeCatalogSyncInFlight || !shouldStartRouteCatalogSync()) return;
|
|
45913
|
+
routeCatalogSyncInFlight = true;
|
|
45914
|
+
syncRouteCatalogIfDue().catch((error) => {
|
|
45915
|
+
failPendingRouteCatalogSyncRequests(error instanceof Error ? error : new Error(toErrorMessage$29(error)));
|
|
45916
|
+
emitRunLine({
|
|
45917
|
+
presenter: input.presenter,
|
|
45918
|
+
code: "daemon.run.catalog_sync_failed",
|
|
45919
|
+
text: `catalog sync failed: ${toErrorMessage$29(error)}`
|
|
45920
|
+
});
|
|
45921
|
+
}).finally(() => {
|
|
45922
|
+
routeCatalogSyncInFlight = false;
|
|
45923
|
+
schedulePendingLocalExecutionEvidenceRefreshIfNeeded();
|
|
45924
|
+
});
|
|
45925
|
+
}
|
|
45926
|
+
async function syncRouteCatalogIfDue() {
|
|
45929
45927
|
const forceReason = forceCatalogSyncReason;
|
|
45930
45928
|
const nowMs = Date.now();
|
|
45931
45929
|
if (!forceReason && nowMs < nextCatalogSyncAtMs) {
|
|
@@ -45939,7 +45937,7 @@ async function runDaemonSocketSession(input) {
|
|
|
45939
45937
|
}
|
|
45940
45938
|
forceCatalogSyncReason = null;
|
|
45941
45939
|
await runCatalogSync(forceReason ? { forceReason } : void 0);
|
|
45942
|
-
}
|
|
45940
|
+
}
|
|
45943
45941
|
const syncRuntimeAgentControllerReportsIfDue = async () => {
|
|
45944
45942
|
if (runtimeAgentControllerReportSyncInFlight || Date.now() < nextRuntimeAgentControllerReportSyncAtMs) return;
|
|
45945
45943
|
runtimeAgentControllerReportSyncInFlight = true;
|
|
@@ -85793,7 +85791,7 @@ const PROMPT_GUIDE_CATALOG = {
|
|
|
85793
85791
|
"Write actions require an active ATS Space Wake dispatch context.",
|
|
85794
85792
|
"`<DISPATCH_ACTION_CLI>` is a placeholder in guides, not a literal command.",
|
|
85795
85793
|
"Fallback JSON is last resort: only if every Space Action CLI command fails, run `ats prompt space-action --raw` and use one trailing `ats-space-action` block.",
|
|
85796
|
-
"Wake targets must be Agent
|
|
85794
|
+
"Wake targets must be active Agent Profile members in the current Space.",
|
|
85797
85795
|
"If a user asks you to deliver work to another Agent Profile, a plain reply is not enough; use `wake` or `reply --wake` so executable work is created.",
|
|
85798
85796
|
"Bare @names in prose are not execution targets in the agent path; use target flags for Wake, Reference, or CC semantics.",
|
|
85799
85797
|
"ATS metadata is infrastructure context, not proof of what a human or agent is doing. Use Space context, private context, memory, and tools when appropriate; avoid exposing secrets, credentials, private files, or high-risk sensitive data unless the owner clearly authorizes it.",
|
|
@@ -95789,17 +95787,11 @@ function runSpaceActionSilent(input) {
|
|
|
95789
95787
|
}
|
|
95790
95788
|
function runSpaceActionTargets() {
|
|
95791
95789
|
const targetReference = requireLoadedTargets(readDispatchSpaceActionContextFromEnv().sendTargetReference);
|
|
95792
|
-
const
|
|
95793
|
-
const blockedWakeTargets = targetReference.projection.filter((target) => target.allowedRelations.wake && target.wakeAvailability.status === "blocked");
|
|
95790
|
+
const wakeTargets = targetReference.projection.filter((target) => target.allowedRelations.wake);
|
|
95794
95791
|
const referenceTargets = targetReference.projection.filter((target) => target.allowedRelations.reference || target.allowedRelations.cc);
|
|
95795
|
-
outLine("
|
|
95796
|
-
if (
|
|
95797
|
-
else for (const target of
|
|
95798
|
-
if (blockedWakeTargets.length > 0) {
|
|
95799
|
-
outLine("");
|
|
95800
|
-
outLine("Blocked wake targets:");
|
|
95801
|
-
for (const target of blockedWakeTargets) outLine(`- ${formatBlockedWakeTargetLine(target)}`);
|
|
95802
|
-
}
|
|
95792
|
+
outLine("Wake targets:");
|
|
95793
|
+
if (wakeTargets.length === 0) outLine("- none");
|
|
95794
|
+
else for (const target of wakeTargets) outLine(`- ${formatTargetLine(target, "wake")}`);
|
|
95803
95795
|
outLine("");
|
|
95804
95796
|
outLine("Reference or CC targets:");
|
|
95805
95797
|
if (referenceTargets.length === 0) outLine("- none");
|
|
@@ -95908,7 +95900,6 @@ function resolveTargetProfileId(input) {
|
|
|
95908
95900
|
const selected = candidates.find((candidate) => candidate.profileId === query) ?? (candidates.length === 1 ? candidates[0] : null);
|
|
95909
95901
|
if (!selected) throw new Error(`Target "${query}" is ambiguous. Choose one of: ${candidates.map((candidate) => candidate.primaryMentionLabel).join(", ")}.`);
|
|
95910
95902
|
if (!selected.allowedRelations[input.relation]) throw new Error(`${formatRelation(input.relation)} is not allowed for ${selected.primaryMentionLabel}.`);
|
|
95911
|
-
if (input.relation === "wake" && selected.wakeAvailability.status !== "ready") throw new Error(`${selected.primaryMentionLabel} is not available for Wake. Run \`${formatAtsCliCommand("ats space action targets")}\` and choose an available Wake target.`);
|
|
95912
95903
|
return selected.profileId;
|
|
95913
95904
|
}
|
|
95914
95905
|
function requireLoadedTargets(targetReference) {
|
|
@@ -95923,7 +95914,7 @@ function targetMatchesQuery(target, query) {
|
|
|
95923
95914
|
target.primaryMentionLabel,
|
|
95924
95915
|
`@${target.primaryMentionLabel}`,
|
|
95925
95916
|
target.mentionAlias,
|
|
95926
|
-
...target.
|
|
95917
|
+
...target.mentionLabels ?? [],
|
|
95927
95918
|
...target.lookupTokens ?? []
|
|
95928
95919
|
].some((candidate) => candidate !== null && candidate !== void 0 && normalizeTargetQuery(candidate) === normalizedQuery);
|
|
95929
95920
|
}
|
|
@@ -95932,17 +95923,12 @@ function normalizeTargetQuery(value) {
|
|
|
95932
95923
|
}
|
|
95933
95924
|
function formatTargetLine(target, relation) {
|
|
95934
95925
|
const relationLabel = formatRelation(relation);
|
|
95935
|
-
|
|
95936
|
-
return `${target.primaryMentionLabel} · ${target.profileKind} · ${relationLabel}${wakeState} · ${target.profileId}`;
|
|
95926
|
+
return `${target.primaryMentionLabel} · ${target.profileKind} · ${relationLabel} · ${target.profileId}`;
|
|
95937
95927
|
}
|
|
95938
95928
|
function formatReferenceOrCcTargetLine(target) {
|
|
95939
95929
|
const relations = [target.allowedRelations.reference ? "Reference" : null, target.allowedRelations.cc ? "CC" : null].filter((relation) => Boolean(relation));
|
|
95940
95930
|
return `${target.primaryMentionLabel} · ${target.profileKind} · ${relations.join(" / ")} · ${target.profileId}`;
|
|
95941
95931
|
}
|
|
95942
|
-
function formatBlockedWakeTargetLine(target) {
|
|
95943
|
-
const reason = target.wakeAvailability.reasonText ? ` · ${target.wakeAvailability.reasonText}` : "";
|
|
95944
|
-
return `${target.primaryMentionLabel} · ${target.profileKind} · Wake blocked${reason} · ${target.profileId}`;
|
|
95945
|
-
}
|
|
95946
95932
|
function formatRelation(relation) {
|
|
95947
95933
|
switch (relation) {
|
|
95948
95934
|
case "wake": return "Wake";
|