openmeld 0.3.233 → 0.3.235
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/{add-me-membership-_O3IzRLn.js → add-me-membership-BVt0EFQ2.js} +2 -2
- package/dist/{add-me-membership-_O3IzRLn.js.map → add-me-membership-BVt0EFQ2.js.map} +1 -1
- package/dist/{agents-B5E7c7sQ.js → agents-Bl_W0SLT.js} +9 -9
- package/dist/{agents-B5E7c7sQ.js.map → agents-Bl_W0SLT.js.map} +1 -1
- package/dist/{api-client-foundation-1p1VVFJ_.js → api-client-foundation-BHjffwwr.js} +1 -1
- package/dist/{api-client-foundation-C-RPnq_p.js → api-client-foundation-D6zHrrGV.js} +3 -3
- package/dist/{api-client-foundation-C-RPnq_p.js.map → api-client-foundation-D6zHrrGV.js.map} +1 -1
- package/dist/auth-session-CCLabxRT.js +4 -0
- package/dist/{auth-session-iXCJO5oB.js → auth-session-CjxqNKvh.js} +2 -2
- package/dist/{auth-session-iXCJO5oB.js.map → auth-session-CjxqNKvh.js.map} +1 -1
- package/dist/{channel-BciBrA3Y.js → channel-BW2_rI6u.js} +3 -3
- package/dist/{channel-BciBrA3Y.js.map → channel-BW2_rI6u.js.map} +1 -1
- package/dist/{command-D0pcAIoE.js → command-vUyYaeck.js} +16 -16
- package/dist/{command-D0pcAIoE.js.map → command-vUyYaeck.js.map} +1 -1
- package/dist/{computer-connection-CHP1-0rK.js → computer-connection-LX1R7jD0.js} +2 -2
- package/dist/{computer-connection-CHP1-0rK.js.map → computer-connection-LX1R7jD0.js.map} +1 -1
- package/dist/{computer-connection-review-dHotFqmD.js → computer-connection-review-Bbp4nzXl.js} +5 -5
- package/dist/{computer-connection-review-dHotFqmD.js.map → computer-connection-review-Bbp4nzXl.js.map} +1 -1
- package/dist/{computer-disconnect-B2DLDxWx.js → computer-disconnect-fbLphD7-.js} +7 -7
- package/dist/{computer-disconnect-B2DLDxWx.js.map → computer-disconnect-fbLphD7-.js.map} +1 -1
- package/dist/{computer-setup-continuation-Cv_c1B-7.js → computer-setup-continuation-CcfcMexz.js} +3 -3
- package/dist/{computer-setup-continuation-Cv_c1B-7.js.map → computer-setup-continuation-CcfcMexz.js.map} +1 -1
- package/dist/{context-BnhlFS8m.js → context-D3GnSqg8.js} +3 -3
- package/dist/{context-BnhlFS8m.js.map → context-D3GnSqg8.js.map} +1 -1
- package/dist/control-plane-QqGL-jtT.js.map +1 -1
- package/dist/{daemon-device-id-DbSIqHoZ.js → daemon-device-id-OMqh2F9_.js} +5 -5
- package/dist/{daemon-device-id-DbSIqHoZ.js.map → daemon-device-id-OMqh2F9_.js.map} +1 -1
- package/dist/{daemon-lifecycle-journal-DsVVvKJe.js → daemon-lifecycle-journal-DEQHGloF.js} +4 -4
- package/dist/{daemon-lifecycle-journal-DsVVvKJe.js.map → daemon-lifecycle-journal-DEQHGloF.js.map} +1 -1
- package/dist/{daemon-service-runtime-DZI6Ke3_.js → daemon-service-runtime-BDlPNE7y.js} +2 -2
- package/dist/{daemon-service-runtime-DZI6Ke3_.js.map → daemon-service-runtime-BDlPNE7y.js.map} +1 -1
- package/dist/{daemon-service-update-coordinator-BgVBlJ4d.js → daemon-service-update-coordinator-D-yjJ2PV.js} +18 -16
- package/dist/{daemon-service-update-coordinator-BgVBlJ4d.js.map → daemon-service-update-coordinator-D-yjJ2PV.js.map} +1 -1
- package/dist/{dispatch-owned-runtime-BeIQetEt.js → dispatch-owned-runtime-FNjbFwSu.js} +50 -617
- package/dist/dispatch-owned-runtime-FNjbFwSu.js.map +1 -0
- package/dist/{dist-BgYBvEBB.js → dist-CJL7LE-y.js} +193 -358
- package/dist/dist-CJL7LE-y.js.map +1 -0
- package/dist/{dist-DQS0XYkb.js → dist-Ccpvj1tf.js} +2 -2
- package/dist/{dist-DQS0XYkb.js.map → dist-Ccpvj1tf.js.map} +1 -1
- package/dist/{dist-z72xYz5Z.js → dist-MpN-h8da.js} +1 -1
- package/dist/{elapsed-time-C7S-6bWV.js → elapsed-time-1d08oEQ3.js} +5 -5
- package/dist/{elapsed-time-C7S-6bWV.js.map → elapsed-time-1d08oEQ3.js.map} +1 -1
- package/dist/{entry-CX24qHnm.js → entry-G1LraPT2.js} +7 -7
- package/dist/{entry-CX24qHnm.js.map → entry-G1LraPT2.js.map} +1 -1
- package/dist/{installation-inventory-B3mwQFEA.js → installation-inventory-BsOTGp_X.js} +3 -3
- package/dist/{installation-inventory-B3mwQFEA.js.map → installation-inventory-BsOTGp_X.js.map} +1 -1
- package/dist/{installer-DnIJ4y3l.js → installer-JpCPmqGj.js} +2 -2
- package/dist/{installer-DnIJ4y3l.js.map → installer-JpCPmqGj.js.map} +1 -1
- package/dist/{meta-api-DgHkiIdr.js → meta-api-ClHCkzZB.js} +4 -4
- package/dist/{meta-api-DgHkiIdr.js.map → meta-api-ClHCkzZB.js.map} +1 -1
- package/dist/{openmeld-kYp99hOl.js → openmeld-BrAKrRtb.js} +32 -32
- package/dist/{openmeld-kYp99hOl.js.map → openmeld-BrAKrRtb.js.map} +1 -1
- package/dist/openmeld-dev-environment-DwdvL7jg.js +24 -0
- package/dist/openmeld-dev-environment-DwdvL7jg.js.map +1 -0
- package/dist/openmeld-dev.js +1 -19
- package/dist/openmeld-dev.js.map +1 -1
- package/dist/{openmeld-maintenance-worker-BqU1Asrm.js → openmeld-maintenance-worker-BuLMqEuI.js} +9 -9
- package/dist/{openmeld-maintenance-worker-BqU1Asrm.js.map → openmeld-maintenance-worker-BuLMqEuI.js.map} +1 -1
- package/dist/{openmeld-tools-update-join-BKJnGR5h.js → openmeld-tools-update-join-3RJrWvrr.js} +4 -4
- package/dist/{openmeld-tools-update-join-BKJnGR5h.js.map → openmeld-tools-update-join-3RJrWvrr.js.map} +1 -1
- package/dist/openmeld.js +4 -4
- package/dist/{prepare-provider-runtime-CD6XRt7X.js → prepare-provider-runtime-Y2WOwFlV.js} +174 -49
- package/dist/prepare-provider-runtime-Y2WOwFlV.js.map +1 -0
- package/dist/{prepare-session-executor-DY2s4FuY.js → prepare-session-executor-B61bBZz0.js} +18 -18
- package/dist/{prepare-session-executor-DY2s4FuY.js.map → prepare-session-executor-B61bBZz0.js.map} +1 -1
- package/dist/{process-channel-CzgOWiuh.js → process-channel-CTPL81j6.js} +2 -2
- package/dist/{process-channel-CzgOWiuh.js.map → process-channel-CTPL81j6.js.map} +1 -1
- package/dist/{runtime-Br4Ga0rJ.js → runtime-CW2rk7-K.js} +7860 -7249
- package/dist/runtime-CW2rk7-K.js.map +1 -0
- package/dist/{runtime-agent-controller-reporting-submission-CQjbBiHh.js → runtime-agent-controller-reporting-submission-DtXqZxol.js} +16 -46
- package/dist/{runtime-agent-controller-reporting-submission-CQjbBiHh.js.map → runtime-agent-controller-reporting-submission-DtXqZxol.js.map} +1 -1
- package/dist/{runtime-transport-D4CVffnp.js → runtime-transport-DyBmX7ds.js} +569 -30
- package/dist/runtime-transport-DyBmX7ds.js.map +1 -0
- package/dist/{service-D9QVc4_y.js → service-BIO-ixp9.js} +68 -38
- package/dist/service-BIO-ixp9.js.map +1 -0
- package/dist/{service-account-authorization-DLhUgGDb.js → service-account-authorization-CdyvPbvg.js} +2 -2
- package/dist/{service-account-authorization-DLhUgGDb.js.map → service-account-authorization-CdyvPbvg.js.map} +1 -1
- package/dist/{service-account-control-DIdQILmo.js → service-account-control-Ddl1E6YF.js} +9 -9
- package/dist/{service-account-control-DIdQILmo.js.map → service-account-control-Ddl1E6YF.js.map} +1 -1
- package/dist/{service-control-capabilities-BvHU_NcX.js → service-control-capabilities-BYmPglLN.js} +1 -1
- package/dist/{service-control-capabilities-CGv5Cuxo.js → service-control-capabilities-CTsm5txF.js} +3 -3
- package/dist/{service-control-capabilities-CGv5Cuxo.js.map → service-control-capabilities-CTsm5txF.js.map} +1 -1
- package/dist/{state-AWe5DSV8.js → state-SRzkI4G2.js} +2 -2
- package/dist/{state-AWe5DSV8.js.map → state-SRzkI4G2.js.map} +1 -1
- package/dist/{runtime-reporting-health-state-a1FUE1S-.js → updates-api-B0f4KyCg.js} +374 -206
- package/dist/updates-api-B0f4KyCg.js.map +1 -0
- package/dist/{upgrade-CcnlL7FH.js → upgrade-BG_Irs5Q.js} +7 -7
- package/dist/{upgrade-CcnlL7FH.js.map → upgrade-BG_Irs5Q.js.map} +1 -1
- package/dist/upgrade-CLdAVKIb.js +4 -0
- package/package.json +11 -11
- package/dist/auth-session-CmjjkLiB.js +0 -4
- package/dist/dispatch-owned-runtime-BeIQetEt.js.map +0 -1
- package/dist/dist-BgYBvEBB.js.map +0 -1
- package/dist/prepare-provider-runtime-CD6XRt7X.js.map +0 -1
- package/dist/runtime-Br4Ga0rJ.js.map +0 -1
- package/dist/runtime-reporting-health-state-a1FUE1S-.js.map +0 -1
- package/dist/runtime-transport-D4CVffnp.js.map +0 -1
- package/dist/service-D9QVc4_y.js.map +0 -1
- package/dist/upgrade-CLnZ4WBF.js +0 -4
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import { g as toSpaceUpdatesUrl } from "./urls-CY2uzH2-.js";
|
|
4
4
|
import { F as resolveOpenMeldRootDir, k as organizationSkillReleaseDir, t as OPENMELD_HOME_ENV_KEY } from "./paths-De9xdA2h.js";
|
|
5
|
-
import { Cr as spaceTaskMutationReceiptSchema,
|
|
6
|
-
import {
|
|
7
|
-
import { Jt as spaceWorkingCopyResultSchema, Kt as spaceWorkRelativePathSchema, Wt as SPACE_WORK_MAX_BYTES, _n as spaceFileEntryIdSchema, an as readSpaceFileTextResponseSchema, cr as executionContextTaskSchema, or as executionContextAssignmentSchema, qt as spaceWorkSelectionSchema, wn as spaceMessageFileReferenceSchema, xn as spaceFileRevisionNumberSchema } from "./runtime-transport-D4CVffnp.js";
|
|
8
|
-
import { d as getAuthSessionState } from "./auth-session-iXCJO5oB.js";
|
|
5
|
+
import { Cr as spaceTaskMutationReceiptSchema, Hr as organizationSkillBundleSchema, Lt as createAgentActivityApi, Pi as signalTextEnvelopeSchema, Sr as spaceTaskIdSchema, br as createSpaceTaskBodySchema, fn as createRuntimeReportingApi, or as getSpaceUpdatesResponseSchema, pi as observedLocalAgentSessionSchema, qr as stringifyOrganizationSkillBundleCanonicalJson, ri as submitAgentControllerTaskLifecycleEventItemSchema, rr as OPENMELD_HEADER_SPACE_ADDRESSING_VERSION, t as OpenMeldApiClientHttpError, xr as mutateSpaceTaskBodySchema } from "./dist-CJL7LE-y.js";
|
|
6
|
+
import { Fn as spaceFileRevisionNumberSchema, Rn as spaceMessageFileReferenceSchema, Sr as executionContextTaskSchema, br as executionContextAssignmentSchema, cn as spaceWorkingCopyResultSchema, in as SPACE_WORK_MAX_BYTES, jn as spaceFileEntryIdSchema, on as spaceWorkRelativePathSchema, sn as spaceWorkSelectionSchema, yn as readSpaceFileTextResponseSchema } from "./runtime-transport-DyBmX7ds.js";
|
|
9
7
|
import { O as openMeldRuntimeProfileIdSchema } from "./control-plane-QqGL-jtT.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
8
|
+
import { $n as resolveExecutablePathsOnPath, On as resolveInstalledClaudeCodeLaunchCandidates, Tt as withAgentActivityLocalStateLock, Xn as resolveDispatchSpaceActionMcpServer, Zn as buildCliLaunchInvocation, er as listAgentControllerSupervisedProcessIds, ft as listProjectBindings, hn as resolveInstalledOpenCodeLaunchCandidates, ht as removeAgentActivityBindingsWhileDeliveryLocked, rr as isDispatchSpaceActionDeliveryOnly, vn as resolveInstalledGrokBuildLaunchCandidates, vt as resolveProjectBindingForPath, wt as withAgentActivityDeliveryLock, xn as resolveInstalledCodexLaunchCandidates } from "./prepare-provider-runtime-Y2WOwFlV.js";
|
|
9
|
+
import { d as getAuthSessionState } from "./auth-session-CjxqNKvh.js";
|
|
10
|
+
import { A as AgentActivitySubmissionResultsMismatchError, D as drainAgentActivityHookInbox, F as removeProjectOutbox, I as readRecentAgentActivityHookStatus, L as createServiceGitEnvironment, M as deferAgentActivityOutbox, N as readAgentActivityOutboxHealth, P as readDueAgentActivityOutbox, S as resolveOpenCodeDatabasePath, T as normalizeSharedSessionTitle, a as DispatchSpaceActionClosedError, b as readOpenCodeSessionRows, d as readDispatchSpaceActionRecord, j as applyAgentActivitySubmissionResults, k as removeProjectInbox, l as readDispatchSpaceActionContextForReceiptFromEnv, o as DispatchSpaceActionRejectedError, p as writeDispatchSpaceActionRecord, pn as cliJsonErrorEnvelopeSchema, s as OPENMELD_SPACE_ACTION_CONTEXT_PATH_ENV, u as readDispatchSpaceActionContextFromEnv, v as scanLocalAgentActivity, w as resolveObservedAgentActivityBinding, y as startAgentActivityTranscriptWatchers } from "./dispatch-owned-runtime-FNjbFwSu.js";
|
|
11
|
+
import { B as requireOpenMeldProfile, o as dirnamePath } from "./daemon-device-id-OMqh2F9_.js";
|
|
12
12
|
import { d as runWithHeldLock, s as releaseLock, t as acquireLock } from "./lock-BMI00i2F.js";
|
|
13
13
|
import { a as resolveBaseUrl } from "./base-url-0AoeTi3w.js";
|
|
14
14
|
import { n as writeDaemonLocalStateFile, t as readDaemonLocalStateFile } from "./daemon-local-state-file-jOXuXrky.js";
|
|
@@ -16,8 +16,8 @@ import { _ as daemonRuntimeStateRootPath } from "./daemon-state-Dte9re5V.js";
|
|
|
16
16
|
import { i as readDaemonServiceContract } from "./daemon-service-contract-COPKbCy_.js";
|
|
17
17
|
import { l as resolveUserFacingCliEntryCommand, n as formatOpenMeldCliCommand } from "./cli-entry-command-CR_9QU1i.js";
|
|
18
18
|
import { r as outLine } from "./io-DT66typ4.js";
|
|
19
|
-
import { d as buildOpenMeldRequestContextFromProfile, l as canAttachAuthTokenToRequest, n as fetchSpaceRequestWithTimeout, s as buildOpenMeldRequestContextHeadersWithAuth, t as createCliApiClientFoundation } from "./api-client-foundation-
|
|
20
|
-
import { d as uploadPreparedSpaceFiles, f as createCliSpaceApi, l as parseJsonResponse, s as readGatewayTextResponse, u as prepareRequestedSpaceSendFiles } from "./meta-api-
|
|
19
|
+
import { d as buildOpenMeldRequestContextFromProfile, l as canAttachAuthTokenToRequest, n as fetchSpaceRequestWithTimeout, s as buildOpenMeldRequestContextHeadersWithAuth, t as createCliApiClientFoundation } from "./api-client-foundation-D6zHrrGV.js";
|
|
20
|
+
import { d as uploadPreparedSpaceFiles, f as createCliSpaceApi, l as parseJsonResponse, s as readGatewayTextResponse, u as prepareRequestedSpaceSendFiles } from "./meta-api-ClHCkzZB.js";
|
|
21
21
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
22
22
|
import { homedir } from "node:os";
|
|
23
23
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
@@ -29,9 +29,9 @@ import { execFile, spawn } from "node:child_process";
|
|
|
29
29
|
import { promisify } from "node:util";
|
|
30
30
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
31
31
|
import { createInterface } from "node:readline";
|
|
32
|
+
import { performance } from "node:perf_hooks";
|
|
32
33
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
33
34
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
34
|
-
import { performance } from "node:perf_hooks";
|
|
35
35
|
//#region ../../packages/schemas/dist/schemas/config/agent-activity-route-registry.js
|
|
36
36
|
const agentActivityRouteRegistrySchema = z$1.strictObject({
|
|
37
37
|
routes: z$1.array(z$1.strictObject({ rootDir: z$1.string().trim().min(1).max(4096) })).max(64),
|
|
@@ -2876,6 +2876,169 @@ async function readLocalReportingHealth(rootDir) {
|
|
|
2876
2876
|
return await Promise.all([readAgentActivityOutboxHealth({ rootDir }), readControllerTaskLifecycleOutboxHealth({ rootDir })]);
|
|
2877
2877
|
}
|
|
2878
2878
|
//#endregion
|
|
2879
|
+
//#region src/local-service/state/ledger-io.ts
|
|
2880
|
+
function createLedgerIo() {
|
|
2881
|
+
return {
|
|
2882
|
+
appendFile: async (filePath, content, encoding) => {
|
|
2883
|
+
await mkdir(dirnamePath(filePath), { recursive: true });
|
|
2884
|
+
await appendFile(filePath, content, { encoding });
|
|
2885
|
+
},
|
|
2886
|
+
copyFile: async (fromPath, toPath) => {
|
|
2887
|
+
await mkdir(dirnamePath(toPath), { recursive: true });
|
|
2888
|
+
await copyFile(fromPath, toPath);
|
|
2889
|
+
},
|
|
2890
|
+
mkdir: async (dirPath, options) => {
|
|
2891
|
+
await mkdir(dirPath, options);
|
|
2892
|
+
},
|
|
2893
|
+
readFile: async (filePath, encoding) => {
|
|
2894
|
+
return await readFile(filePath, encoding);
|
|
2895
|
+
},
|
|
2896
|
+
rename: async (fromPath, toPath) => {
|
|
2897
|
+
await mkdir(dirnamePath(toPath), { recursive: true });
|
|
2898
|
+
await rename(fromPath, toPath);
|
|
2899
|
+
},
|
|
2900
|
+
syncPath: async (fileOrDirectoryPath) => {
|
|
2901
|
+
const isWindows = process.platform === "win32";
|
|
2902
|
+
if (isWindows && (await stat(fileOrDirectoryPath)).isDirectory()) return;
|
|
2903
|
+
const handle = await open(fileOrDirectoryPath, isWindows ? "r+" : "r");
|
|
2904
|
+
try {
|
|
2905
|
+
await handle.sync();
|
|
2906
|
+
} finally {
|
|
2907
|
+
await handle.close();
|
|
2908
|
+
}
|
|
2909
|
+
},
|
|
2910
|
+
rm: async (filePath, options) => {
|
|
2911
|
+
await rm(filePath, options);
|
|
2912
|
+
},
|
|
2913
|
+
writeFile: async (filePath, content, encoding) => {
|
|
2914
|
+
await mkdir(dirnamePath(filePath), { recursive: true });
|
|
2915
|
+
await writeFile(filePath, content, encoding);
|
|
2916
|
+
}
|
|
2917
|
+
};
|
|
2918
|
+
}
|
|
2919
|
+
//#endregion
|
|
2920
|
+
//#region src/local-service/state/runtime-reporting-health-state.ts
|
|
2921
|
+
const RUNTIME_REPORTING_HEALTH_FILENAME = "reporting-health.json";
|
|
2922
|
+
const DIAGNOSTIC_WHITESPACE_RE = /\s+/gu;
|
|
2923
|
+
const stateUpdateQueueByPath = /* @__PURE__ */ new Map();
|
|
2924
|
+
function runtimeReportingHealthStatePath(pathInput = {}) {
|
|
2925
|
+
return join(daemonRuntimeStateRootPath(pathInput), RUNTIME_REPORTING_HEALTH_FILENAME);
|
|
2926
|
+
}
|
|
2927
|
+
async function readRuntimeReportingHealthState(pathInput = {}, expectedServiceIdentity) {
|
|
2928
|
+
const state = await readDaemonLocalStateFile({
|
|
2929
|
+
path: runtimeReportingHealthStatePath(pathInput),
|
|
2930
|
+
schema: runtimeReportingHealthStateSchema
|
|
2931
|
+
});
|
|
2932
|
+
if (!(state && expectedServiceIdentity)) return state;
|
|
2933
|
+
return isSameServiceIdentity(state.serviceIdentity, expectedServiceIdentity) ? state : createInitialRuntimeReportingHealthState(expectedServiceIdentity);
|
|
2934
|
+
}
|
|
2935
|
+
async function recordRuntimeReportingFailure(input) {
|
|
2936
|
+
return await updateRuntimeReportingHealthState(input.pathInput, input.serviceIdentity, (current) => {
|
|
2937
|
+
const channelState = current[input.channel];
|
|
2938
|
+
const observedAt = input.at ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
2939
|
+
return {
|
|
2940
|
+
...current,
|
|
2941
|
+
[input.channel]: {
|
|
2942
|
+
...channelState,
|
|
2943
|
+
applicability: {
|
|
2944
|
+
observedAt,
|
|
2945
|
+
status: "applicable"
|
|
2946
|
+
},
|
|
2947
|
+
consecutiveFailures: channelState.consecutiveFailures + 1,
|
|
2948
|
+
lastFailure: {
|
|
2949
|
+
at: observedAt,
|
|
2950
|
+
reasonCode: normalizeDiagnosticText({
|
|
2951
|
+
fallback: "runtime.reporting.failed",
|
|
2952
|
+
maxLength: 160,
|
|
2953
|
+
value: input.reasonCode
|
|
2954
|
+
}),
|
|
2955
|
+
message: normalizeDiagnosticText({
|
|
2956
|
+
fallback: "Runtime reporting failed.",
|
|
2957
|
+
maxLength: 500,
|
|
2958
|
+
value: input.message
|
|
2959
|
+
})
|
|
2960
|
+
},
|
|
2961
|
+
lastSuccessAt: channelState.applicability?.status === "not_applicable" ? null : channelState.lastSuccessAt
|
|
2962
|
+
}
|
|
2963
|
+
};
|
|
2964
|
+
});
|
|
2965
|
+
}
|
|
2966
|
+
function normalizeDiagnosticText(input) {
|
|
2967
|
+
return (input.value.replace(DIAGNOSTIC_WHITESPACE_RE, " ").trim() || input.fallback).slice(0, input.maxLength);
|
|
2968
|
+
}
|
|
2969
|
+
async function recordRuntimeReportingSuccess(input) {
|
|
2970
|
+
return await updateRuntimeReportingHealthState(input.pathInput, input.serviceIdentity, (current) => {
|
|
2971
|
+
const observedAt = input.at ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
2972
|
+
return {
|
|
2973
|
+
...current,
|
|
2974
|
+
[input.channel]: {
|
|
2975
|
+
applicability: {
|
|
2976
|
+
observedAt,
|
|
2977
|
+
status: "applicable"
|
|
2978
|
+
},
|
|
2979
|
+
lastSuccessAt: observedAt,
|
|
2980
|
+
consecutiveFailures: 0,
|
|
2981
|
+
lastFailure: null
|
|
2982
|
+
}
|
|
2983
|
+
};
|
|
2984
|
+
});
|
|
2985
|
+
}
|
|
2986
|
+
async function recordRuntimeReportingNotApplicable(input) {
|
|
2987
|
+
return await updateRuntimeReportingHealthState(input.pathInput, input.serviceIdentity, (current) => ({
|
|
2988
|
+
...current,
|
|
2989
|
+
[input.channel]: {
|
|
2990
|
+
...current[input.channel],
|
|
2991
|
+
applicability: {
|
|
2992
|
+
observedAt: input.at ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
2993
|
+
status: "not_applicable"
|
|
2994
|
+
},
|
|
2995
|
+
consecutiveFailures: 0,
|
|
2996
|
+
lastFailure: null
|
|
2997
|
+
}
|
|
2998
|
+
}));
|
|
2999
|
+
}
|
|
3000
|
+
function createInitialRuntimeReportingHealthState(serviceIdentity) {
|
|
3001
|
+
return {
|
|
3002
|
+
schema: RUNTIME_REPORTING_HEALTH_SCHEMA_NAME,
|
|
3003
|
+
v: 1,
|
|
3004
|
+
serviceIdentity,
|
|
3005
|
+
serviceIdentityObservedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3006
|
+
runtimeAgentController: createInitialRuntimeReportingChannelHealth(),
|
|
3007
|
+
providerConversationProof: createInitialRuntimeReportingChannelHealth()
|
|
3008
|
+
};
|
|
3009
|
+
}
|
|
3010
|
+
function createInitialRuntimeReportingChannelHealth() {
|
|
3011
|
+
return {
|
|
3012
|
+
lastSuccessAt: null,
|
|
3013
|
+
consecutiveFailures: 0,
|
|
3014
|
+
lastFailure: null
|
|
3015
|
+
};
|
|
3016
|
+
}
|
|
3017
|
+
async function writeRuntimeReportingHealthState(state, pathInput = {}) {
|
|
3018
|
+
await writeDaemonLocalStateFile({
|
|
3019
|
+
path: runtimeReportingHealthStatePath(pathInput),
|
|
3020
|
+
schema: runtimeReportingHealthStateSchema,
|
|
3021
|
+
value: state,
|
|
3022
|
+
mode: 384
|
|
3023
|
+
});
|
|
3024
|
+
}
|
|
3025
|
+
function updateRuntimeReportingHealthState(pathInput, serviceIdentity, update) {
|
|
3026
|
+
const path = runtimeReportingHealthStatePath(pathInput);
|
|
3027
|
+
const updatePromise = (stateUpdateQueueByPath.get(path) ?? Promise.resolve()).then(async () => {
|
|
3028
|
+
const next = update(await readRuntimeReportingHealthState(pathInput, serviceIdentity) ?? createInitialRuntimeReportingHealthState(serviceIdentity));
|
|
3029
|
+
await writeRuntimeReportingHealthState(next, pathInput);
|
|
3030
|
+
return next;
|
|
3031
|
+
});
|
|
3032
|
+
const queueTail = updatePromise.then(() => void 0, () => void 0);
|
|
3033
|
+
stateUpdateQueueByPath.set(path, queueTail);
|
|
3034
|
+
return updatePromise.finally(() => {
|
|
3035
|
+
if (stateUpdateQueueByPath.get(path) === queueTail) stateUpdateQueueByPath.delete(path);
|
|
3036
|
+
});
|
|
3037
|
+
}
|
|
3038
|
+
function isSameServiceIdentity(left, right) {
|
|
3039
|
+
return left?.deviceId === right.deviceId && left.contractGeneration === right.contractGeneration;
|
|
3040
|
+
}
|
|
3041
|
+
//#endregion
|
|
2879
3042
|
//#region src/runtime/dispatch-space-progress-relay.ts
|
|
2880
3043
|
const DISPATCH_PROGRESS_RELAY_FILENAME = "progress.ndjson";
|
|
2881
3044
|
const DISPATCH_PROGRESS_RELAY_POLL_INTERVAL_MS = 50;
|
|
@@ -3246,45 +3409,159 @@ function assertContainedWorkspace(boundaryRoot, workspacePath) {
|
|
|
3246
3409
|
return within.split(sep).join("/");
|
|
3247
3410
|
}
|
|
3248
3411
|
//#endregion
|
|
3249
|
-
//#region src/local-service/
|
|
3250
|
-
|
|
3412
|
+
//#region src/local-service/dispatch/execution-context-git-config.ts
|
|
3413
|
+
const entries = z.record(z.string(), z.array(z.string()));
|
|
3414
|
+
const executionContextGitConfigBaselineSchema = z.strictObject({
|
|
3415
|
+
common: entries,
|
|
3416
|
+
worktree: entries
|
|
3417
|
+
});
|
|
3418
|
+
const EXECUTABLE_KEY = /^(?:core\.(?:fsmonitor|hooksPath|sshCommand|worktree|pager|editor)|filter\..+|.+\.textconv|diff\..+\.command|credential\.helper|include\.path|includeIf\..+\.path|sequence\.editor|gpg\..*program|uploadpack\.packObjectsHook)$/iu;
|
|
3419
|
+
const HOOK_INSTALLER = /\b(?:husky|lefthook)\b/u;
|
|
3420
|
+
function executableSetting(key, values) {
|
|
3421
|
+
return EXECUTABLE_KEY.test(key) || key.toLowerCase().startsWith("alias.") && values.some((value) => value.trimStart().startsWith("!"));
|
|
3422
|
+
}
|
|
3423
|
+
async function readConfig(path, run) {
|
|
3424
|
+
const info = await lstat(path).catch((error) => {
|
|
3425
|
+
if (error.code === "ENOENT") return null;
|
|
3426
|
+
throw error;
|
|
3427
|
+
});
|
|
3428
|
+
if (!info) return {};
|
|
3429
|
+
if (!info.isFile() || info.nlink !== 1 || info.size > 64 * 1024) throw new Error("execution_context.workspace_git_config_invalid");
|
|
3430
|
+
const output = await run(dirname(path), [
|
|
3431
|
+
"config",
|
|
3432
|
+
"--file",
|
|
3433
|
+
path,
|
|
3434
|
+
"--no-includes",
|
|
3435
|
+
"--null",
|
|
3436
|
+
"--list"
|
|
3437
|
+
]);
|
|
3438
|
+
const result = {};
|
|
3439
|
+
for (const field of output.split("\0")) {
|
|
3440
|
+
if (!field) continue;
|
|
3441
|
+
const separator = field.indexOf("\n");
|
|
3442
|
+
const key = (separator < 0 ? field : field.slice(0, separator)).toLowerCase();
|
|
3443
|
+
const value = separator < 0 ? "" : field.slice(separator + 1);
|
|
3444
|
+
result[key] ??= [];
|
|
3445
|
+
result[key].push(value);
|
|
3446
|
+
}
|
|
3447
|
+
return result;
|
|
3448
|
+
}
|
|
3449
|
+
function configPaths(root) {
|
|
3251
3450
|
return {
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3451
|
+
common: join(root, "repository.git/config"),
|
|
3452
|
+
worktree: join(root, "repository.git/worktrees/worktree/config.worktree")
|
|
3453
|
+
};
|
|
3454
|
+
}
|
|
3455
|
+
async function captureExecutionContextGitConfig(root, run) {
|
|
3456
|
+
const paths = configPaths(root);
|
|
3457
|
+
const result = {
|
|
3458
|
+
common: await readConfig(paths.common, run),
|
|
3459
|
+
worktree: await readConfig(paths.worktree, run)
|
|
3460
|
+
};
|
|
3461
|
+
for (const group of Object.values(result)) for (const [key, values] of Object.entries(group)) if (!executableSetting(key, values)) delete group[key];
|
|
3462
|
+
return result;
|
|
3463
|
+
}
|
|
3464
|
+
function baselinePath(ledgerRoot, contextId) {
|
|
3465
|
+
if (!z.uuid().safeParse(contextId).success) throw new Error("execution_context.workspace_identity_mismatch");
|
|
3466
|
+
return join(ledgerRoot, "execution-context-git-config-baselines", `${contextId}.json`);
|
|
3467
|
+
}
|
|
3468
|
+
async function saveExecutionContextGitConfigBaseline(ledgerRoot, contextId, baseline) {
|
|
3469
|
+
const path = baselinePath(ledgerRoot, contextId);
|
|
3470
|
+
await mkdir(dirname(path), {
|
|
3471
|
+
recursive: true,
|
|
3472
|
+
mode: 448
|
|
3473
|
+
});
|
|
3474
|
+
const temporary = `${path}.${randomUUID()}.tmp`;
|
|
3475
|
+
const file = await open(temporary, "wx", 384);
|
|
3476
|
+
try {
|
|
3477
|
+
await file.writeFile(JSON.stringify(baseline), "utf8");
|
|
3478
|
+
await file.sync();
|
|
3479
|
+
} finally {
|
|
3480
|
+
await file.close();
|
|
3481
|
+
}
|
|
3482
|
+
await rename(temporary, path);
|
|
3483
|
+
}
|
|
3484
|
+
async function readExecutionContextGitConfigBaseline(ledgerRoot, contextId) {
|
|
3485
|
+
const path = baselinePath(ledgerRoot, contextId);
|
|
3486
|
+
const info = await lstat(path);
|
|
3487
|
+
if (!info.isFile() || info.nlink !== 1 || info.size > 256 * 1024) throw new Error("execution_context.workspace_git_config_baseline_invalid");
|
|
3488
|
+
return executionContextGitConfigBaselineSchema.parse(JSON.parse(await readFile(path, "utf8")));
|
|
3489
|
+
}
|
|
3490
|
+
async function isDeclaredHookInstaller(worktree, value, run) {
|
|
3491
|
+
const path = resolve(worktree, value);
|
|
3492
|
+
const child = relative(worktree, path);
|
|
3493
|
+
if (!child || isAbsolute(child) || child === ".." || child.startsWith(`..${sep}`)) return false;
|
|
3494
|
+
const canonical = await realpath(path).catch(() => null);
|
|
3495
|
+
if (!canonical || canonical !== path) return false;
|
|
3496
|
+
const packageText = await run(worktree, ["show", "HEAD:package.json"]).catch(() => null);
|
|
3497
|
+
if (!packageText) return false;
|
|
3498
|
+
let packageValue;
|
|
3499
|
+
try {
|
|
3500
|
+
packageValue = JSON.parse(packageText);
|
|
3501
|
+
} catch {
|
|
3502
|
+
return false;
|
|
3503
|
+
}
|
|
3504
|
+
const parsed = z.object({ scripts: z.record(z.string(), z.string()).optional() }).safeParse(packageValue);
|
|
3505
|
+
if (!(parsed.success && Object.values(parsed.data.scripts ?? {}).some((script) => HOOK_INSTALLER.test(script)))) return false;
|
|
3506
|
+
return (await run(worktree, [
|
|
3507
|
+
"ls-tree",
|
|
3508
|
+
"-r",
|
|
3509
|
+
"--name-only",
|
|
3510
|
+
"HEAD",
|
|
3511
|
+
"--",
|
|
3512
|
+
child.split(sep)[0] ?? child
|
|
3513
|
+
])).length > 0;
|
|
3514
|
+
}
|
|
3515
|
+
async function restoreSetting(input) {
|
|
3516
|
+
try {
|
|
3517
|
+
await input.run(input.worktree, [
|
|
3518
|
+
"config",
|
|
3519
|
+
"--file",
|
|
3520
|
+
input.path,
|
|
3521
|
+
"--unset-all",
|
|
3522
|
+
input.key
|
|
3523
|
+
]);
|
|
3524
|
+
for (const value of input.values) await input.run(input.worktree, [
|
|
3525
|
+
"config",
|
|
3526
|
+
"--file",
|
|
3527
|
+
input.path,
|
|
3528
|
+
"--add",
|
|
3529
|
+
input.key,
|
|
3530
|
+
value
|
|
3531
|
+
]);
|
|
3532
|
+
} catch {
|
|
3533
|
+
throw new Error("execution_context.workspace_git_config_audit_failed");
|
|
3534
|
+
}
|
|
3535
|
+
}
|
|
3536
|
+
async function auditExecutionContextGitConfig(input) {
|
|
3537
|
+
const audit = {
|
|
3538
|
+
restoredSettings: 0,
|
|
3539
|
+
declaredHookInstallers: 0,
|
|
3540
|
+
unverifiedHookSettings: 0
|
|
3541
|
+
};
|
|
3542
|
+
const worktree = join(input.root, "worktree");
|
|
3543
|
+
const paths = configPaths(input.root);
|
|
3544
|
+
for (const group of ["common", "worktree"]) {
|
|
3545
|
+
const path = paths[group];
|
|
3546
|
+
const current = await readConfig(path, input.run);
|
|
3547
|
+
for (const [key, values] of Object.entries(current)) {
|
|
3548
|
+
if (!executableSetting(key, values) || JSON.stringify(values) === JSON.stringify(input.baseline[group][key])) continue;
|
|
3549
|
+
if (key === "core.hookspath") {
|
|
3550
|
+
if (await isDeclaredHookInstaller(worktree, values.at(-1) ?? "", input.run)) audit.declaredHookInstallers += 1;
|
|
3551
|
+
else audit.unverifiedHookSettings += 1;
|
|
3552
|
+
continue;
|
|
3278
3553
|
}
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3554
|
+
await restoreSetting({
|
|
3555
|
+
run: input.run,
|
|
3556
|
+
worktree,
|
|
3557
|
+
path,
|
|
3558
|
+
key,
|
|
3559
|
+
values: input.baseline[group][key] ?? []
|
|
3560
|
+
});
|
|
3561
|
+
audit.restoredSettings += 1;
|
|
3286
3562
|
}
|
|
3287
|
-
}
|
|
3563
|
+
}
|
|
3564
|
+
return audit;
|
|
3288
3565
|
}
|
|
3289
3566
|
//#endregion
|
|
3290
3567
|
//#region src/local-service/dispatch/execution-context-workspace.ts
|
|
@@ -3489,6 +3766,7 @@ async function markExecutionContextWorkspaceInUse(input) {
|
|
|
3489
3766
|
const path = join(root, "execution-context-workspace-records", `${context.id}.json`);
|
|
3490
3767
|
const record = await readManifest(path);
|
|
3491
3768
|
if (record?.status !== "completed") throw failure("workspace_execution_quiescence_unconfirmed");
|
|
3769
|
+
await saveExecutionContextGitConfigBaseline(root, context.id, await captureExecutionContextGitConfig(record.boundaryRoot, git));
|
|
3492
3770
|
await writeManifest(path, {
|
|
3493
3771
|
...record,
|
|
3494
3772
|
status: "in_use",
|
|
@@ -3509,6 +3787,15 @@ async function markExecutionContextWorkspaceInUse(input) {
|
|
|
3509
3787
|
throw error;
|
|
3510
3788
|
}
|
|
3511
3789
|
}
|
|
3790
|
+
async function auditWorkspaceGitConfig(input) {
|
|
3791
|
+
if (!input.use) return;
|
|
3792
|
+
const audit = await auditExecutionContextGitConfig({
|
|
3793
|
+
root: input.boundaryRoot,
|
|
3794
|
+
baseline: await readExecutionContextGitConfigBaseline(input.ledgerRoot, input.contextId),
|
|
3795
|
+
run: git
|
|
3796
|
+
});
|
|
3797
|
+
return Object.values(audit).some((count) => count > 0) ? audit : void 0;
|
|
3798
|
+
}
|
|
3512
3799
|
async function releaseExecutionContextWorkspace(input) {
|
|
3513
3800
|
const root = await canonicalDirectory(input.ledgerRootPath);
|
|
3514
3801
|
try {
|
|
@@ -3528,6 +3815,12 @@ async function releaseExecutionContextWorkspace(input) {
|
|
|
3528
3815
|
status: "retained",
|
|
3529
3816
|
reason: "execution_quiescence_unconfirmed"
|
|
3530
3817
|
};
|
|
3818
|
+
const gitConfigAudit = await auditWorkspaceGitConfig({
|
|
3819
|
+
use: input.use,
|
|
3820
|
+
boundaryRoot: record.boundaryRoot,
|
|
3821
|
+
ledgerRoot: root,
|
|
3822
|
+
contextId: input.context.id
|
|
3823
|
+
});
|
|
3531
3824
|
const { activeAttemptId: _activeAttemptId, activeDispatchId: _activeDispatchId, containerRuntime: _containerRuntime, ...quiescentRecord } = record;
|
|
3532
3825
|
const completed = {
|
|
3533
3826
|
...quiescentRecord,
|
|
@@ -3537,24 +3830,32 @@ async function releaseExecutionContextWorkspace(input) {
|
|
|
3537
3830
|
record = await removePristineRetirement(completed, path);
|
|
3538
3831
|
if (record.retirement) return {
|
|
3539
3832
|
status: "retained",
|
|
3540
|
-
reason: "cleanup_incomplete"
|
|
3833
|
+
reason: "cleanup_incomplete",
|
|
3834
|
+
gitConfigAudit
|
|
3541
3835
|
};
|
|
3542
3836
|
if (!record.pristineFingerprint) return {
|
|
3543
3837
|
status: "retained",
|
|
3544
|
-
reason: "baseline_unverified"
|
|
3838
|
+
reason: "baseline_unverified",
|
|
3839
|
+
gitConfigAudit
|
|
3545
3840
|
};
|
|
3546
3841
|
await verifyRetainedWorkspace(record);
|
|
3547
3842
|
if (await fingerprintDirectory(record.boundaryRoot) !== record.pristineFingerprint) return {
|
|
3548
3843
|
status: "retained",
|
|
3549
|
-
reason: "workspace_changed"
|
|
3844
|
+
reason: "workspace_changed",
|
|
3845
|
+
gitConfigAudit
|
|
3550
3846
|
};
|
|
3551
3847
|
if (record.sourceWorkingDirectory && !await sourceHasCommit(record)) return {
|
|
3552
3848
|
status: "retained",
|
|
3553
|
-
reason: "source_commit_unavailable"
|
|
3849
|
+
reason: "source_commit_unavailable",
|
|
3850
|
+
gitConfigAudit
|
|
3554
3851
|
};
|
|
3555
|
-
return (await retirePristineWorkspace(record, path)).status === "released" ? {
|
|
3852
|
+
return (await retirePristineWorkspace(record, path)).status === "released" ? {
|
|
3853
|
+
status: "released",
|
|
3854
|
+
gitConfigAudit
|
|
3855
|
+
} : {
|
|
3556
3856
|
status: "retained",
|
|
3557
|
-
reason: "workspace_changed"
|
|
3857
|
+
reason: "workspace_changed",
|
|
3858
|
+
gitConfigAudit
|
|
3558
3859
|
};
|
|
3559
3860
|
});
|
|
3560
3861
|
} finally {
|
|
@@ -3756,7 +4057,17 @@ async function acquireWorkspaceExecutionLock(root, contextId) {
|
|
|
3756
4057
|
});
|
|
3757
4058
|
}
|
|
3758
4059
|
function workspaceResult(manifest) {
|
|
4060
|
+
const repository = join(manifest.boundaryRoot, "repository.git");
|
|
4061
|
+
const gitDirectory = join(repository, "worktrees", "worktree");
|
|
3759
4062
|
return {
|
|
4063
|
+
...manifest.sourceWorkingDirectory ? { gitMetadata: {
|
|
4064
|
+
commonDirectoryPointerPath: join(gitDirectory, "commondir"),
|
|
4065
|
+
configPath: join(repository, "config"),
|
|
4066
|
+
gitDirectoryPointerPath: join(gitDirectory, "gitdir"),
|
|
4067
|
+
hooksPath: join(repository, "hooks"),
|
|
4068
|
+
worktreeConfigPath: join(gitDirectory, "config.worktree"),
|
|
4069
|
+
worktreeGitPointerPath: join(manifest.workingDirectory, ".git")
|
|
4070
|
+
} } : {},
|
|
3760
4071
|
workingDirectory: manifest.workingDirectory,
|
|
3761
4072
|
boundaryRoot: manifest.boundaryRoot,
|
|
3762
4073
|
...manifest.sourceWorkingDirectory ? { sourceWorkingDirectory: manifest.sourceWorkingDirectory } : {},
|
|
@@ -3870,38 +4181,17 @@ function within(child, parent) {
|
|
|
3870
4181
|
const path = relative(resolve(parent), child);
|
|
3871
4182
|
return path === "" || path !== ".." && !path.startsWith(`..${sep}`) && !isAbsolute(path);
|
|
3872
4183
|
}
|
|
3873
|
-
const GIT_SETTINGS = {
|
|
3874
|
-
"core.hooksPath": "/dev/null",
|
|
3875
|
-
"core.attributesFile": "/dev/null",
|
|
3876
|
-
"core.fsmonitor": "false",
|
|
3877
|
-
"credential.helper": "",
|
|
3878
|
-
"protocol.allow": "never",
|
|
3879
|
-
"protocol.file.allow": "always",
|
|
3880
|
-
"fetch.recurseSubmodules": "false",
|
|
3881
|
-
"submodule.recurse": "false",
|
|
3882
|
-
"uploadpack.packObjectsHook": "",
|
|
3883
|
-
"gc.auto": "0",
|
|
3884
|
-
"maintenance.auto": "false"
|
|
3885
|
-
};
|
|
3886
4184
|
async function git(cwd, args, processSupervisionId) {
|
|
3887
|
-
const env =
|
|
3888
|
-
Object.assign(env, {
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
GIT_TERMINAL_PROMPT: "0",
|
|
3898
|
-
GIT_CONFIG_COUNT: String(Object.keys(GIT_SETTINGS).length)
|
|
3899
|
-
});
|
|
3900
|
-
for (const [index, [key, value]] of Object.entries(GIT_SETTINGS).entries()) {
|
|
3901
|
-
env[`GIT_CONFIG_KEY_${index}`] = key;
|
|
3902
|
-
env[`GIT_CONFIG_VALUE_${index}`] = value;
|
|
3903
|
-
}
|
|
3904
|
-
return (await execFileAsync$1("git", args, {
|
|
4185
|
+
const env = createServiceGitEnvironment();
|
|
4186
|
+
Object.assign(env, { ...processSupervisionId ? { OPENMELD_PROCESS_SUPERVISION_ID: processSupervisionId } : {} });
|
|
4187
|
+
return (await execFileAsync$1("git", [
|
|
4188
|
+
"-c",
|
|
4189
|
+
"core.fsmonitor=false",
|
|
4190
|
+
"-c",
|
|
4191
|
+
"core.hooksPath=/dev/null",
|
|
4192
|
+
...await lstat(join(cwd, ".git")).catch(() => null) ? ["-c", `core.worktree=${cwd}`] : [],
|
|
4193
|
+
...args
|
|
4194
|
+
], {
|
|
3905
4195
|
cwd,
|
|
3906
4196
|
env,
|
|
3907
4197
|
encoding: "utf8",
|
|
@@ -5632,128 +5922,6 @@ async function fetchSpaceUpdates(input) {
|
|
|
5632
5922
|
return parsed.data;
|
|
5633
5923
|
}
|
|
5634
5924
|
//#endregion
|
|
5635
|
-
|
|
5636
|
-
const RUNTIME_REPORTING_HEALTH_FILENAME = "reporting-health.json";
|
|
5637
|
-
const DIAGNOSTIC_WHITESPACE_RE = /\s+/gu;
|
|
5638
|
-
const stateUpdateQueueByPath = /* @__PURE__ */ new Map();
|
|
5639
|
-
function runtimeReportingHealthStatePath(pathInput = {}) {
|
|
5640
|
-
return join(daemonRuntimeStateRootPath(pathInput), RUNTIME_REPORTING_HEALTH_FILENAME);
|
|
5641
|
-
}
|
|
5642
|
-
async function readRuntimeReportingHealthState(pathInput = {}, expectedServiceIdentity) {
|
|
5643
|
-
const state = await readDaemonLocalStateFile({
|
|
5644
|
-
path: runtimeReportingHealthStatePath(pathInput),
|
|
5645
|
-
schema: runtimeReportingHealthStateSchema
|
|
5646
|
-
});
|
|
5647
|
-
if (!(state && expectedServiceIdentity)) return state;
|
|
5648
|
-
return isSameServiceIdentity(state.serviceIdentity, expectedServiceIdentity) ? state : createInitialRuntimeReportingHealthState(expectedServiceIdentity);
|
|
5649
|
-
}
|
|
5650
|
-
async function recordRuntimeReportingFailure(input) {
|
|
5651
|
-
return await updateRuntimeReportingHealthState(input.pathInput, input.serviceIdentity, (current) => {
|
|
5652
|
-
const channelState = current[input.channel];
|
|
5653
|
-
const observedAt = input.at ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
5654
|
-
return {
|
|
5655
|
-
...current,
|
|
5656
|
-
[input.channel]: {
|
|
5657
|
-
...channelState,
|
|
5658
|
-
applicability: {
|
|
5659
|
-
observedAt,
|
|
5660
|
-
status: "applicable"
|
|
5661
|
-
},
|
|
5662
|
-
consecutiveFailures: channelState.consecutiveFailures + 1,
|
|
5663
|
-
lastFailure: {
|
|
5664
|
-
at: observedAt,
|
|
5665
|
-
reasonCode: normalizeDiagnosticText({
|
|
5666
|
-
fallback: "runtime.reporting.failed",
|
|
5667
|
-
maxLength: 160,
|
|
5668
|
-
value: input.reasonCode
|
|
5669
|
-
}),
|
|
5670
|
-
message: normalizeDiagnosticText({
|
|
5671
|
-
fallback: "Runtime reporting failed.",
|
|
5672
|
-
maxLength: 500,
|
|
5673
|
-
value: input.message
|
|
5674
|
-
})
|
|
5675
|
-
},
|
|
5676
|
-
lastSuccessAt: channelState.applicability?.status === "not_applicable" ? null : channelState.lastSuccessAt
|
|
5677
|
-
}
|
|
5678
|
-
};
|
|
5679
|
-
});
|
|
5680
|
-
}
|
|
5681
|
-
function normalizeDiagnosticText(input) {
|
|
5682
|
-
return (input.value.replace(DIAGNOSTIC_WHITESPACE_RE, " ").trim() || input.fallback).slice(0, input.maxLength);
|
|
5683
|
-
}
|
|
5684
|
-
async function recordRuntimeReportingSuccess(input) {
|
|
5685
|
-
return await updateRuntimeReportingHealthState(input.pathInput, input.serviceIdentity, (current) => {
|
|
5686
|
-
const observedAt = input.at ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
5687
|
-
return {
|
|
5688
|
-
...current,
|
|
5689
|
-
[input.channel]: {
|
|
5690
|
-
applicability: {
|
|
5691
|
-
observedAt,
|
|
5692
|
-
status: "applicable"
|
|
5693
|
-
},
|
|
5694
|
-
lastSuccessAt: observedAt,
|
|
5695
|
-
consecutiveFailures: 0,
|
|
5696
|
-
lastFailure: null
|
|
5697
|
-
}
|
|
5698
|
-
};
|
|
5699
|
-
});
|
|
5700
|
-
}
|
|
5701
|
-
async function recordRuntimeReportingNotApplicable(input) {
|
|
5702
|
-
return await updateRuntimeReportingHealthState(input.pathInput, input.serviceIdentity, (current) => ({
|
|
5703
|
-
...current,
|
|
5704
|
-
[input.channel]: {
|
|
5705
|
-
...current[input.channel],
|
|
5706
|
-
applicability: {
|
|
5707
|
-
observedAt: input.at ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
5708
|
-
status: "not_applicable"
|
|
5709
|
-
},
|
|
5710
|
-
consecutiveFailures: 0,
|
|
5711
|
-
lastFailure: null
|
|
5712
|
-
}
|
|
5713
|
-
}));
|
|
5714
|
-
}
|
|
5715
|
-
function createInitialRuntimeReportingHealthState(serviceIdentity) {
|
|
5716
|
-
return {
|
|
5717
|
-
schema: RUNTIME_REPORTING_HEALTH_SCHEMA_NAME,
|
|
5718
|
-
v: 1,
|
|
5719
|
-
serviceIdentity,
|
|
5720
|
-
serviceIdentityObservedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5721
|
-
runtimeAgentController: createInitialRuntimeReportingChannelHealth(),
|
|
5722
|
-
providerConversationProof: createInitialRuntimeReportingChannelHealth()
|
|
5723
|
-
};
|
|
5724
|
-
}
|
|
5725
|
-
function createInitialRuntimeReportingChannelHealth() {
|
|
5726
|
-
return {
|
|
5727
|
-
lastSuccessAt: null,
|
|
5728
|
-
consecutiveFailures: 0,
|
|
5729
|
-
lastFailure: null
|
|
5730
|
-
};
|
|
5731
|
-
}
|
|
5732
|
-
async function writeRuntimeReportingHealthState(state, pathInput = {}) {
|
|
5733
|
-
await writeDaemonLocalStateFile({
|
|
5734
|
-
path: runtimeReportingHealthStatePath(pathInput),
|
|
5735
|
-
schema: runtimeReportingHealthStateSchema,
|
|
5736
|
-
value: state,
|
|
5737
|
-
mode: 384
|
|
5738
|
-
});
|
|
5739
|
-
}
|
|
5740
|
-
function updateRuntimeReportingHealthState(pathInput, serviceIdentity, update) {
|
|
5741
|
-
const path = runtimeReportingHealthStatePath(pathInput);
|
|
5742
|
-
const updatePromise = (stateUpdateQueueByPath.get(path) ?? Promise.resolve()).then(async () => {
|
|
5743
|
-
const next = update(await readRuntimeReportingHealthState(pathInput, serviceIdentity) ?? createInitialRuntimeReportingHealthState(serviceIdentity));
|
|
5744
|
-
await writeRuntimeReportingHealthState(next, pathInput);
|
|
5745
|
-
return next;
|
|
5746
|
-
});
|
|
5747
|
-
const queueTail = updatePromise.then(() => void 0, () => void 0);
|
|
5748
|
-
stateUpdateQueueByPath.set(path, queueTail);
|
|
5749
|
-
return updatePromise.finally(() => {
|
|
5750
|
-
if (stateUpdateQueueByPath.get(path) === queueTail) stateUpdateQueueByPath.delete(path);
|
|
5751
|
-
});
|
|
5752
|
-
}
|
|
5753
|
-
function isSameServiceIdentity(left, right) {
|
|
5754
|
-
return left?.deviceId === right.deviceId && left.contractGeneration === right.contractGeneration;
|
|
5755
|
-
}
|
|
5756
|
-
//#endregion
|
|
5757
|
-
export { enqueueControllerTaskLifecycleEventWhileLocked as A, resolveAgentActivityDispatcherCommand as B, startDispatchSpaceProgressRelay as C, recordOpenMeldCreatedLocalAgentSession as D, discoverLocalAgentSessionProviders as E, unregisterAgentActivityRoute as F, AGENT_ACTIVITY_INTEGRATION_OWNER as I, defaultManagedIntegrationPaths as L, isAgentActivityRouteRegistered as M, registerAgentActivityRoute as N, readAgentActivityContextForPath as O, resolveAgentActivityRouteForPath as P, installAgentActivityIntegrations as R, prepareClaudeProjectContainer as S, syncLocalAgentActivity as T, uninstallAgentActivityIntegrations as V, markExecutionContextWorkspaceInUse as _, fetchSpaceUpdates as a, releaseExecutionContextWorkspace as b, materializeOrganizationSkillRelease as c, runSpaceActionHelp as d, runSpaceActionReply as f, runSpaceActionWake as g, runSpaceActionTargets as h, recordRuntimeReportingSuccess as i, readControllerTaskLifecycleOutboxHealth as j, removeAgentActivityContextCache as k, createDispatchSpaceTools as l, runSpaceActionStatus as m, recordRuntimeReportingFailure as n, createSpaceWorkingCopies as o, runSpaceActionSilent as p, recordRuntimeReportingNotApplicable as r, downloadWorkingCopyFile as s, readRuntimeReportingHealthState as t, runSpaceActionMcpServer as u, prepareExecutionContextWorkspace as v, startLocalAgentActivitySyncLoop as w, createLedgerIo as x, readExecutionContextWorkspace as y, readAgentActivityIntegrationStatus as z };
|
|
5925
|
+
export { enqueueControllerTaskLifecycleEventWhileLocked as A, resolveAgentActivityDispatcherCommand as B, createLedgerIo as C, recordOpenMeldCreatedLocalAgentSession as D, discoverLocalAgentSessionProviders as E, unregisterAgentActivityRoute as F, AGENT_ACTIVITY_INTEGRATION_OWNER as I, defaultManagedIntegrationPaths as L, isAgentActivityRouteRegistered as M, registerAgentActivityRoute as N, readAgentActivityContextForPath as O, resolveAgentActivityRouteForPath as P, installAgentActivityIntegrations as R, recordRuntimeReportingSuccess as S, syncLocalAgentActivity as T, uninstallAgentActivityIntegrations as V, prepareClaudeProjectContainer as _, createDispatchSpaceTools as a, recordRuntimeReportingFailure as b, runSpaceActionReply as c, runSpaceActionTargets as d, runSpaceActionWake as f, releaseExecutionContextWorkspace as g, readExecutionContextWorkspace as h, materializeOrganizationSkillRelease as i, readControllerTaskLifecycleOutboxHealth as j, removeAgentActivityContextCache as k, runSpaceActionSilent as l, prepareExecutionContextWorkspace as m, createSpaceWorkingCopies as n, runSpaceActionMcpServer as o, markExecutionContextWorkspaceInUse as p, downloadWorkingCopyFile as r, runSpaceActionHelp as s, fetchSpaceUpdates as t, runSpaceActionStatus as u, startDispatchSpaceProgressRelay as v, startLocalAgentActivitySyncLoop as w, recordRuntimeReportingNotApplicable as x, readRuntimeReportingHealthState as y, readAgentActivityIntegrationStatus as z };
|
|
5758
5926
|
|
|
5759
|
-
//# sourceMappingURL=
|
|
5927
|
+
//# sourceMappingURL=updates-api-B0f4KyCg.js.map
|