@zixt/host 0.0.68 → 0.0.70
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/index.js +454 -375
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ import { homedir } from "node:os";
|
|
|
31
31
|
// package.json
|
|
32
32
|
var package_default = {
|
|
33
33
|
name: "@zixt/host",
|
|
34
|
-
version: "0.0.
|
|
34
|
+
version: "0.0.70",
|
|
35
35
|
type: "module",
|
|
36
36
|
exports: {
|
|
37
37
|
".": "./src/client.ts",
|
|
@@ -15437,6 +15437,19 @@ var WorkspaceTelemetry = external_exports.object({
|
|
|
15437
15437
|
checkedAt: IsoDate2,
|
|
15438
15438
|
error: external_exports.string().max(1e3).nullable()
|
|
15439
15439
|
});
|
|
15440
|
+
var HostHardware = external_exports.object({
|
|
15441
|
+
cpuCount: external_exports.number().int().min(1).max(4096),
|
|
15442
|
+
memoryTotalBytes: external_exports.number().int().min(0),
|
|
15443
|
+
/** Unused memory right now, not memory reclaimable from caches. */
|
|
15444
|
+
memoryFreeBytes: external_exports.number().int().min(0),
|
|
15445
|
+
/** Null when the Machine's own filesystem could not be measured. */
|
|
15446
|
+
disk: external_exports.object({
|
|
15447
|
+
/** The measured filesystem's path, so free space names what it describes. */
|
|
15448
|
+
path: SafeDisplayPath,
|
|
15449
|
+
totalBytes: external_exports.number().int().min(0),
|
|
15450
|
+
freeBytes: external_exports.number().int().min(0)
|
|
15451
|
+
}).nullable().default(null)
|
|
15452
|
+
});
|
|
15440
15453
|
var ProviderToolPackCapabilityBase = {
|
|
15441
15454
|
version: external_exports.literal(1),
|
|
15442
15455
|
checkedAt: IsoDate2,
|
|
@@ -15479,6 +15492,12 @@ var HostTelemetry = external_exports.object({
|
|
|
15479
15492
|
runners: external_exports.array(RunnerTelemetry).default([]),
|
|
15480
15493
|
workspaces: external_exports.array(WorkspaceTelemetry).default([]),
|
|
15481
15494
|
docker: external_exports.enum(["available", "unavailable", "unknown"]).default("unknown"),
|
|
15495
|
+
/**
|
|
15496
|
+
* Additive capacity evidence. Optional rather than defaulted so a Host, a
|
|
15497
|
+
* fixture, or a stored document written before hardware reporting existed is
|
|
15498
|
+
* still a complete `HostTelemetry`; the cloud projects the absence as null.
|
|
15499
|
+
*/
|
|
15500
|
+
hardware: HostHardware.nullable().optional(),
|
|
15482
15501
|
/** Additive bundled tool-pack support; missing legacy hosts report false. */
|
|
15483
15502
|
capabilities: external_exports.object({
|
|
15484
15503
|
/**
|
|
@@ -16758,7 +16777,7 @@ var ListTasksResponse = external_exports.object({
|
|
|
16758
16777
|
}).strict();
|
|
16759
16778
|
|
|
16760
16779
|
// ../../packages/contracts/src/protocol.ts
|
|
16761
|
-
var PROTOCOL_VERSION =
|
|
16780
|
+
var PROTOCOL_VERSION = 8;
|
|
16762
16781
|
var BROWSER_PROFILE_INVENTORY_PAGE_SIZE = 200;
|
|
16763
16782
|
var TASK_CANCEL_ACK_EVENT = "zixt.task.cancel.acknowledged";
|
|
16764
16783
|
var TASK_CREDENTIAL_ROLLOVER_ACK_EVENT = "zixt.task.credential_rollover.acknowledged";
|
|
@@ -17452,7 +17471,7 @@ var GithubTaskGrantBase = {
|
|
|
17452
17471
|
installationAccount: external_exports.object({
|
|
17453
17472
|
accountId: GithubNumericId,
|
|
17454
17473
|
login: external_exports.string().min(1).max(100),
|
|
17455
|
-
type: external_exports.
|
|
17474
|
+
type: external_exports.enum(["Organization", "User"])
|
|
17456
17475
|
}).strict(),
|
|
17457
17476
|
installationRevision: external_exports.number().int().min(1),
|
|
17458
17477
|
ownershipRevision: external_exports.number().int().min(1),
|
|
@@ -17567,6 +17586,13 @@ var GithubTaskGrant = external_exports.union([
|
|
|
17567
17586
|
message: "operations and effectiveCapabilities must be the same duplicate-free set"
|
|
17568
17587
|
});
|
|
17569
17588
|
}
|
|
17589
|
+
if (grant.installationAccount.type === "User" && grant.operations.includes("repository.create")) {
|
|
17590
|
+
ctx.addIssue({
|
|
17591
|
+
code: "custom",
|
|
17592
|
+
path: ["operations"],
|
|
17593
|
+
message: "personal GitHub installations cannot grant repository creation"
|
|
17594
|
+
});
|
|
17595
|
+
}
|
|
17570
17596
|
});
|
|
17571
17597
|
var LinearProviderTaskGrant = LinearTaskGrant.extend({
|
|
17572
17598
|
provider: external_exports.literal("linear")
|
|
@@ -18466,6 +18492,186 @@ var ManagerStreamFrame = external_exports.discriminatedUnion("type", [
|
|
|
18466
18492
|
external_exports.object({ type: external_exports.literal("conversation"), conversation: ConversationProjection }).strict()
|
|
18467
18493
|
]);
|
|
18468
18494
|
|
|
18495
|
+
// ../../packages/contracts/src/platform.ts
|
|
18496
|
+
var JournalEntry = external_exports.object({
|
|
18497
|
+
id: external_exports.string(),
|
|
18498
|
+
agentId: AgentId,
|
|
18499
|
+
/** auto = task/comm lifecycle; note = agent-written. */
|
|
18500
|
+
kind: external_exports.enum(["auto", "note"]),
|
|
18501
|
+
text: external_exports.string().min(1).max(1e4),
|
|
18502
|
+
at: IsoDate2
|
|
18503
|
+
});
|
|
18504
|
+
var MemoryEntry = external_exports.object({
|
|
18505
|
+
id: external_exports.string(),
|
|
18506
|
+
agentId: AgentId,
|
|
18507
|
+
/** Machine display name; null = true everywhere (global). */
|
|
18508
|
+
machine: external_exports.string().nullable(),
|
|
18509
|
+
kind: external_exports.enum(["fact", "preference", "lesson", "context", "correction", "project", "environment"]),
|
|
18510
|
+
/** TS-10: written during an external-origin run; render as untrusted data. */
|
|
18511
|
+
trust: external_exports.enum(["internal", "external"]),
|
|
18512
|
+
text: external_exports.string().min(1).max(2e3),
|
|
18513
|
+
updatedAt: IsoDate2
|
|
18514
|
+
});
|
|
18515
|
+
var JournalResponse = external_exports.object({
|
|
18516
|
+
/** Bounded current-state summary (compaction target). */
|
|
18517
|
+
summary: external_exports.string(),
|
|
18518
|
+
entries: external_exports.array(JournalEntry),
|
|
18519
|
+
/** Curated memory, newest first. Absent only from pre-memory clients' view. */
|
|
18520
|
+
memories: external_exports.array(MemoryEntry).default([])
|
|
18521
|
+
});
|
|
18522
|
+
var AuditRecord = external_exports.object({
|
|
18523
|
+
id: external_exports.string(),
|
|
18524
|
+
/** member:<id>, agent:<id>, host:<id>, or system. */
|
|
18525
|
+
actor: external_exports.string(),
|
|
18526
|
+
action: external_exports.string(),
|
|
18527
|
+
/** Prefixed id of the acted-on resource. */
|
|
18528
|
+
target: external_exports.string(),
|
|
18529
|
+
summary: external_exports.string().max(2e3),
|
|
18530
|
+
/** Exact machine-readable deltas when the event changes configuration. */
|
|
18531
|
+
changes: external_exports.object({
|
|
18532
|
+
connectionAccess: external_exports.object({ before: ConnectionAccess, after: ConnectionAccess }).optional(),
|
|
18533
|
+
requiredConnectionIds: external_exports.object({
|
|
18534
|
+
before: external_exports.array(ConnectionId).max(100),
|
|
18535
|
+
after: external_exports.array(ConnectionId).max(100)
|
|
18536
|
+
}).optional(),
|
|
18537
|
+
integrationSettings: external_exports.object({ before: IntegrationSettings, after: IntegrationSettings }).optional()
|
|
18538
|
+
}).strict().optional(),
|
|
18539
|
+
at: IsoDate2
|
|
18540
|
+
});
|
|
18541
|
+
var ListAuditResponse = external_exports.object({ records: external_exports.array(AuditRecord) });
|
|
18542
|
+
var SecretScope = external_exports.enum(["org", "agent"]);
|
|
18543
|
+
var SecretKind = external_exports.enum(["env", "web_login"]);
|
|
18544
|
+
var SecretMeta = external_exports.object({
|
|
18545
|
+
name: external_exports.string().min(1).max(120).regex(/^[A-Z][A-Z0-9_]*$/, "UPPER_SNAKE_CASE env var name"),
|
|
18546
|
+
/** Absent on legacy rows/clients means `env`. */
|
|
18547
|
+
kind: SecretKind.default("env"),
|
|
18548
|
+
scope: SecretScope,
|
|
18549
|
+
/** Canonical availability set for teammate-scoped credentials. */
|
|
18550
|
+
agentIds: external_exports.array(AgentId).min(1).nullable().default(null),
|
|
18551
|
+
/** Legacy single-teammate projection, retained while older clients migrate. */
|
|
18552
|
+
agentId: AgentId.nullable(),
|
|
18553
|
+
/**
|
|
18554
|
+
* What this credential is for — rendered into the agent's system prompt
|
|
18555
|
+
* (names and descriptions only, never values) so the agent knows what it
|
|
18556
|
+
* holds and when to reach for it.
|
|
18557
|
+
*/
|
|
18558
|
+
description: external_exports.string().max(500).optional(),
|
|
18559
|
+
/** web_login metadata (admin projection only; never the password). */
|
|
18560
|
+
webLogin: external_exports.object({ loginUrl: external_exports.url().max(2e3), username: external_exports.string().min(1).max(500) }).strict().optional(),
|
|
18561
|
+
updatedAt: IsoDate2
|
|
18562
|
+
});
|
|
18563
|
+
var PutSecretFields = {
|
|
18564
|
+
name: SecretMeta.shape.name,
|
|
18565
|
+
kind: SecretKind.default("env"),
|
|
18566
|
+
/** env kind: required single value. */
|
|
18567
|
+
value: external_exports.string().min(1).max(1e4).optional(),
|
|
18568
|
+
/** web_login kind: required structured value. */
|
|
18569
|
+
webLogin: WebLoginValue.optional(),
|
|
18570
|
+
description: external_exports.string().max(500).optional()
|
|
18571
|
+
};
|
|
18572
|
+
var requireKindMatchingValue = (request, ctx) => {
|
|
18573
|
+
if (request.kind === "env") {
|
|
18574
|
+
if (request.value === void 0)
|
|
18575
|
+
ctx.addIssue({ code: "custom", path: ["value"], message: "env credentials require a value" });
|
|
18576
|
+
if (request.webLogin !== void 0)
|
|
18577
|
+
ctx.addIssue({
|
|
18578
|
+
code: "custom",
|
|
18579
|
+
path: ["webLogin"],
|
|
18580
|
+
message: "env credentials must not carry a website login"
|
|
18581
|
+
});
|
|
18582
|
+
} else {
|
|
18583
|
+
if (request.webLogin === void 0)
|
|
18584
|
+
ctx.addIssue({
|
|
18585
|
+
code: "custom",
|
|
18586
|
+
path: ["webLogin"],
|
|
18587
|
+
message: "website logins require loginUrl, username, and password"
|
|
18588
|
+
});
|
|
18589
|
+
if (request.value !== void 0)
|
|
18590
|
+
ctx.addIssue({
|
|
18591
|
+
code: "custom",
|
|
18592
|
+
path: ["value"],
|
|
18593
|
+
message: "website logins must not carry a bare value"
|
|
18594
|
+
});
|
|
18595
|
+
}
|
|
18596
|
+
};
|
|
18597
|
+
var PutSecretRequest = external_exports.discriminatedUnion("scope", [
|
|
18598
|
+
external_exports.object({ ...PutSecretFields, scope: external_exports.literal("org") }).strict().superRefine(requireKindMatchingValue),
|
|
18599
|
+
external_exports.object({
|
|
18600
|
+
...PutSecretFields,
|
|
18601
|
+
scope: external_exports.literal("agent"),
|
|
18602
|
+
agentIds: external_exports.array(AgentId).min(1).max(100).optional(),
|
|
18603
|
+
agentId: AgentId.optional()
|
|
18604
|
+
}).strict().superRefine((request, ctx) => {
|
|
18605
|
+
if (request.agentIds === void 0 === (request.agentId === void 0)) {
|
|
18606
|
+
ctx.addIssue({
|
|
18607
|
+
code: "custom",
|
|
18608
|
+
path: ["agentIds"],
|
|
18609
|
+
message: "teammate credentials require exactly one of agentIds or legacy agentId"
|
|
18610
|
+
});
|
|
18611
|
+
}
|
|
18612
|
+
if (request.agentIds && new Set(request.agentIds).size !== request.agentIds.length) {
|
|
18613
|
+
ctx.addIssue({ code: "custom", path: ["agentIds"], message: "duplicate AI teammate" });
|
|
18614
|
+
}
|
|
18615
|
+
}).superRefine(requireKindMatchingValue)
|
|
18616
|
+
]);
|
|
18617
|
+
var AdminSecretsProjection = external_exports.object({
|
|
18618
|
+
metadataRedacted: external_exports.literal(false),
|
|
18619
|
+
secrets: external_exports.array(SecretMeta)
|
|
18620
|
+
}).strict();
|
|
18621
|
+
var MemberSecretsProjection = external_exports.object({
|
|
18622
|
+
metadataRedacted: external_exports.literal(true),
|
|
18623
|
+
configured: external_exports.boolean(),
|
|
18624
|
+
secrets: external_exports.tuple([])
|
|
18625
|
+
}).strict();
|
|
18626
|
+
var ListSecretsResponse = external_exports.discriminatedUnion("metadataRedacted", [
|
|
18627
|
+
AdminSecretsProjection,
|
|
18628
|
+
MemberSecretsProjection
|
|
18629
|
+
]);
|
|
18630
|
+
var Invite = external_exports.object({
|
|
18631
|
+
id: external_exports.string(),
|
|
18632
|
+
orgId: OrgId,
|
|
18633
|
+
email: external_exports.email(),
|
|
18634
|
+
role: OrgRole.exclude(["owner"]),
|
|
18635
|
+
acceptedAt: IsoDate2.nullable(),
|
|
18636
|
+
expiresAt: IsoDate2,
|
|
18637
|
+
revokedAt: IsoDate2.nullable(),
|
|
18638
|
+
createdAt: IsoDate2
|
|
18639
|
+
});
|
|
18640
|
+
var CreateInviteRequest = external_exports.object({
|
|
18641
|
+
email: external_exports.email(),
|
|
18642
|
+
role: OrgRole.exclude(["owner"]).default("member")
|
|
18643
|
+
});
|
|
18644
|
+
var CreateInviteResponse = external_exports.object({
|
|
18645
|
+
invite: Invite,
|
|
18646
|
+
/** One-time acceptance URL, also emailed when the deployment has SMTP. */
|
|
18647
|
+
acceptUrl: external_exports.url(),
|
|
18648
|
+
/** True when the invitation email was accepted by the mail server. */
|
|
18649
|
+
emailed: external_exports.boolean().default(false)
|
|
18650
|
+
});
|
|
18651
|
+
var ListInvitesResponse = external_exports.object({ invites: external_exports.array(Invite) });
|
|
18652
|
+
var UpdateMemberRoleRequest = external_exports.object({ role: OrgRole });
|
|
18653
|
+
var ConnectorKind = external_exports.enum([
|
|
18654
|
+
"github",
|
|
18655
|
+
"slack",
|
|
18656
|
+
"linear",
|
|
18657
|
+
"zendesk",
|
|
18658
|
+
"jira",
|
|
18659
|
+
"email",
|
|
18660
|
+
"mcp"
|
|
18661
|
+
]);
|
|
18662
|
+
var ConnectorCatalogEntry = external_exports.object({
|
|
18663
|
+
kind: ConnectorKind,
|
|
18664
|
+
name: external_exports.string(),
|
|
18665
|
+
description: external_exports.string(),
|
|
18666
|
+
status: external_exports.enum(["available", "coming_soon"])
|
|
18667
|
+
});
|
|
18668
|
+
var ConnectionsCatalogResponse = external_exports.object({
|
|
18669
|
+
catalog: external_exports.array(ConnectorCatalogEntry),
|
|
18670
|
+
connections: external_exports.array(
|
|
18671
|
+
external_exports.object({ id: MemberId.or(external_exports.string()), kind: ConnectorKind, name: external_exports.string() })
|
|
18672
|
+
)
|
|
18673
|
+
});
|
|
18674
|
+
|
|
18469
18675
|
// ../../packages/contracts/src/api.ts
|
|
18470
18676
|
var ProblemCode = external_exports.enum([
|
|
18471
18677
|
"network_unavailable",
|
|
@@ -18513,6 +18719,11 @@ var CreateOrgRequest = external_exports.object({
|
|
|
18513
18719
|
name: Org.shape.name,
|
|
18514
18720
|
slug: Org.shape.slug
|
|
18515
18721
|
});
|
|
18722
|
+
var RenameOrgRequest = external_exports.object({
|
|
18723
|
+
// Trimmed before the length checks so surrounding whitespace cannot pass as a
|
|
18724
|
+
// name and leave the organization blank everywhere its name is displayed.
|
|
18725
|
+
name: external_exports.string().trim().pipe(Org.shape.name)
|
|
18726
|
+
});
|
|
18516
18727
|
var DESKTOP_SIDEBAR_MIN_WIDTH_PX = 240;
|
|
18517
18728
|
var DESKTOP_SIDEBAR_MAX_WIDTH_PX = 420;
|
|
18518
18729
|
var TASK_SIDEBAR_MIN_WIDTH_PX = 240;
|
|
@@ -18814,6 +19025,15 @@ var HostConsoleResponse = external_exports.object({
|
|
|
18814
19025
|
available: external_exports.boolean()
|
|
18815
19026
|
});
|
|
18816
19027
|
var HostUpdateResponse = external_exports.object({ accepted: external_exports.literal(true) });
|
|
19028
|
+
var MachineMemoryEntry = MemoryEntry.omit({ machine: true }).extend({
|
|
19029
|
+
agentName: external_exports.string().min(1).max(120)
|
|
19030
|
+
});
|
|
19031
|
+
var MachineMemoriesResponse = external_exports.object({
|
|
19032
|
+
/** Machine-scoped memory across the organization's teammates, newest first. */
|
|
19033
|
+
memories: external_exports.array(MachineMemoryEntry).max(200).default([]),
|
|
19034
|
+
/** True when older entries exist beyond the bounded set; never silent. */
|
|
19035
|
+
truncated: external_exports.boolean().default(false)
|
|
19036
|
+
});
|
|
18817
19037
|
|
|
18818
19038
|
// ../../packages/contracts/src/redaction.ts
|
|
18819
19039
|
var REDACTED_CREDENTIAL = "[REDACTED]";
|
|
@@ -19842,11 +20062,6 @@ var HttpOrigin2 = external_exports.url().max(2e3).refine((value) => {
|
|
|
19842
20062
|
return (parsed.protocol === "https:" || parsed.protocol === "http:" && (parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1")) && parsed.origin === value && parsed.username === "" && parsed.password === "";
|
|
19843
20063
|
}, "must be an exact credential-free HTTPS origin or local loopback HTTP origin");
|
|
19844
20064
|
var StartGithubConnectionRequest = external_exports.object({
|
|
19845
|
-
/**
|
|
19846
|
-
* Reopen GitHub's account picker instead of the account already connected.
|
|
19847
|
-
* Configuring the known account is one click; changing it is deliberate.
|
|
19848
|
-
*/
|
|
19849
|
-
switchAccount: external_exports.boolean().optional(),
|
|
19850
20065
|
returnPath: SafeReturnPath2.optional()
|
|
19851
20066
|
}).strict();
|
|
19852
20067
|
var StartGithubTeammateOAuthRequest = external_exports.object({
|
|
@@ -19916,186 +20131,6 @@ var BrowserOAuthConfig = external_exports.object({
|
|
|
19916
20131
|
githubAppSlug: GithubAppSlug.nullable()
|
|
19917
20132
|
}).strict();
|
|
19918
20133
|
|
|
19919
|
-
// ../../packages/contracts/src/platform.ts
|
|
19920
|
-
var JournalEntry = external_exports.object({
|
|
19921
|
-
id: external_exports.string(),
|
|
19922
|
-
agentId: AgentId,
|
|
19923
|
-
/** auto = task/comm lifecycle; note = agent-written. */
|
|
19924
|
-
kind: external_exports.enum(["auto", "note"]),
|
|
19925
|
-
text: external_exports.string().min(1).max(1e4),
|
|
19926
|
-
at: IsoDate2
|
|
19927
|
-
});
|
|
19928
|
-
var MemoryEntry = external_exports.object({
|
|
19929
|
-
id: external_exports.string(),
|
|
19930
|
-
agentId: AgentId,
|
|
19931
|
-
/** Machine display name; null = true everywhere (global). */
|
|
19932
|
-
machine: external_exports.string().nullable(),
|
|
19933
|
-
kind: external_exports.enum(["fact", "preference", "lesson", "context", "correction", "project", "environment"]),
|
|
19934
|
-
/** TS-10: written during an external-origin run; render as untrusted data. */
|
|
19935
|
-
trust: external_exports.enum(["internal", "external"]),
|
|
19936
|
-
text: external_exports.string().min(1).max(2e3),
|
|
19937
|
-
updatedAt: IsoDate2
|
|
19938
|
-
});
|
|
19939
|
-
var JournalResponse = external_exports.object({
|
|
19940
|
-
/** Bounded current-state summary (compaction target). */
|
|
19941
|
-
summary: external_exports.string(),
|
|
19942
|
-
entries: external_exports.array(JournalEntry),
|
|
19943
|
-
/** Curated memory, newest first. Absent only from pre-memory clients' view. */
|
|
19944
|
-
memories: external_exports.array(MemoryEntry).default([])
|
|
19945
|
-
});
|
|
19946
|
-
var AuditRecord = external_exports.object({
|
|
19947
|
-
id: external_exports.string(),
|
|
19948
|
-
/** member:<id>, agent:<id>, host:<id>, or system. */
|
|
19949
|
-
actor: external_exports.string(),
|
|
19950
|
-
action: external_exports.string(),
|
|
19951
|
-
/** Prefixed id of the acted-on resource. */
|
|
19952
|
-
target: external_exports.string(),
|
|
19953
|
-
summary: external_exports.string().max(2e3),
|
|
19954
|
-
/** Exact machine-readable deltas when the event changes configuration. */
|
|
19955
|
-
changes: external_exports.object({
|
|
19956
|
-
connectionAccess: external_exports.object({ before: ConnectionAccess, after: ConnectionAccess }).optional(),
|
|
19957
|
-
requiredConnectionIds: external_exports.object({
|
|
19958
|
-
before: external_exports.array(ConnectionId).max(100),
|
|
19959
|
-
after: external_exports.array(ConnectionId).max(100)
|
|
19960
|
-
}).optional(),
|
|
19961
|
-
integrationSettings: external_exports.object({ before: IntegrationSettings, after: IntegrationSettings }).optional()
|
|
19962
|
-
}).strict().optional(),
|
|
19963
|
-
at: IsoDate2
|
|
19964
|
-
});
|
|
19965
|
-
var ListAuditResponse = external_exports.object({ records: external_exports.array(AuditRecord) });
|
|
19966
|
-
var SecretScope = external_exports.enum(["org", "agent"]);
|
|
19967
|
-
var SecretKind = external_exports.enum(["env", "web_login"]);
|
|
19968
|
-
var SecretMeta = external_exports.object({
|
|
19969
|
-
name: external_exports.string().min(1).max(120).regex(/^[A-Z][A-Z0-9_]*$/, "UPPER_SNAKE_CASE env var name"),
|
|
19970
|
-
/** Absent on legacy rows/clients means `env`. */
|
|
19971
|
-
kind: SecretKind.default("env"),
|
|
19972
|
-
scope: SecretScope,
|
|
19973
|
-
/** Canonical availability set for teammate-scoped credentials. */
|
|
19974
|
-
agentIds: external_exports.array(AgentId).min(1).nullable().default(null),
|
|
19975
|
-
/** Legacy single-teammate projection, retained while older clients migrate. */
|
|
19976
|
-
agentId: AgentId.nullable(),
|
|
19977
|
-
/**
|
|
19978
|
-
* What this credential is for — rendered into the agent's system prompt
|
|
19979
|
-
* (names and descriptions only, never values) so the agent knows what it
|
|
19980
|
-
* holds and when to reach for it.
|
|
19981
|
-
*/
|
|
19982
|
-
description: external_exports.string().max(500).optional(),
|
|
19983
|
-
/** web_login metadata (admin projection only; never the password). */
|
|
19984
|
-
webLogin: external_exports.object({ loginUrl: external_exports.url().max(2e3), username: external_exports.string().min(1).max(500) }).strict().optional(),
|
|
19985
|
-
updatedAt: IsoDate2
|
|
19986
|
-
});
|
|
19987
|
-
var PutSecretFields = {
|
|
19988
|
-
name: SecretMeta.shape.name,
|
|
19989
|
-
kind: SecretKind.default("env"),
|
|
19990
|
-
/** env kind: required single value. */
|
|
19991
|
-
value: external_exports.string().min(1).max(1e4).optional(),
|
|
19992
|
-
/** web_login kind: required structured value. */
|
|
19993
|
-
webLogin: WebLoginValue.optional(),
|
|
19994
|
-
description: external_exports.string().max(500).optional()
|
|
19995
|
-
};
|
|
19996
|
-
var requireKindMatchingValue = (request, ctx) => {
|
|
19997
|
-
if (request.kind === "env") {
|
|
19998
|
-
if (request.value === void 0)
|
|
19999
|
-
ctx.addIssue({ code: "custom", path: ["value"], message: "env credentials require a value" });
|
|
20000
|
-
if (request.webLogin !== void 0)
|
|
20001
|
-
ctx.addIssue({
|
|
20002
|
-
code: "custom",
|
|
20003
|
-
path: ["webLogin"],
|
|
20004
|
-
message: "env credentials must not carry a website login"
|
|
20005
|
-
});
|
|
20006
|
-
} else {
|
|
20007
|
-
if (request.webLogin === void 0)
|
|
20008
|
-
ctx.addIssue({
|
|
20009
|
-
code: "custom",
|
|
20010
|
-
path: ["webLogin"],
|
|
20011
|
-
message: "website logins require loginUrl, username, and password"
|
|
20012
|
-
});
|
|
20013
|
-
if (request.value !== void 0)
|
|
20014
|
-
ctx.addIssue({
|
|
20015
|
-
code: "custom",
|
|
20016
|
-
path: ["value"],
|
|
20017
|
-
message: "website logins must not carry a bare value"
|
|
20018
|
-
});
|
|
20019
|
-
}
|
|
20020
|
-
};
|
|
20021
|
-
var PutSecretRequest = external_exports.discriminatedUnion("scope", [
|
|
20022
|
-
external_exports.object({ ...PutSecretFields, scope: external_exports.literal("org") }).strict().superRefine(requireKindMatchingValue),
|
|
20023
|
-
external_exports.object({
|
|
20024
|
-
...PutSecretFields,
|
|
20025
|
-
scope: external_exports.literal("agent"),
|
|
20026
|
-
agentIds: external_exports.array(AgentId).min(1).max(100).optional(),
|
|
20027
|
-
agentId: AgentId.optional()
|
|
20028
|
-
}).strict().superRefine((request, ctx) => {
|
|
20029
|
-
if (request.agentIds === void 0 === (request.agentId === void 0)) {
|
|
20030
|
-
ctx.addIssue({
|
|
20031
|
-
code: "custom",
|
|
20032
|
-
path: ["agentIds"],
|
|
20033
|
-
message: "teammate credentials require exactly one of agentIds or legacy agentId"
|
|
20034
|
-
});
|
|
20035
|
-
}
|
|
20036
|
-
if (request.agentIds && new Set(request.agentIds).size !== request.agentIds.length) {
|
|
20037
|
-
ctx.addIssue({ code: "custom", path: ["agentIds"], message: "duplicate AI teammate" });
|
|
20038
|
-
}
|
|
20039
|
-
}).superRefine(requireKindMatchingValue)
|
|
20040
|
-
]);
|
|
20041
|
-
var AdminSecretsProjection = external_exports.object({
|
|
20042
|
-
metadataRedacted: external_exports.literal(false),
|
|
20043
|
-
secrets: external_exports.array(SecretMeta)
|
|
20044
|
-
}).strict();
|
|
20045
|
-
var MemberSecretsProjection = external_exports.object({
|
|
20046
|
-
metadataRedacted: external_exports.literal(true),
|
|
20047
|
-
configured: external_exports.boolean(),
|
|
20048
|
-
secrets: external_exports.tuple([])
|
|
20049
|
-
}).strict();
|
|
20050
|
-
var ListSecretsResponse = external_exports.discriminatedUnion("metadataRedacted", [
|
|
20051
|
-
AdminSecretsProjection,
|
|
20052
|
-
MemberSecretsProjection
|
|
20053
|
-
]);
|
|
20054
|
-
var Invite = external_exports.object({
|
|
20055
|
-
id: external_exports.string(),
|
|
20056
|
-
orgId: OrgId,
|
|
20057
|
-
email: external_exports.email(),
|
|
20058
|
-
role: OrgRole.exclude(["owner"]),
|
|
20059
|
-
acceptedAt: IsoDate2.nullable(),
|
|
20060
|
-
expiresAt: IsoDate2,
|
|
20061
|
-
revokedAt: IsoDate2.nullable(),
|
|
20062
|
-
createdAt: IsoDate2
|
|
20063
|
-
});
|
|
20064
|
-
var CreateInviteRequest = external_exports.object({
|
|
20065
|
-
email: external_exports.email(),
|
|
20066
|
-
role: OrgRole.exclude(["owner"]).default("member")
|
|
20067
|
-
});
|
|
20068
|
-
var CreateInviteResponse = external_exports.object({
|
|
20069
|
-
invite: Invite,
|
|
20070
|
-
/** One-time acceptance URL, also emailed when the deployment has SMTP. */
|
|
20071
|
-
acceptUrl: external_exports.url(),
|
|
20072
|
-
/** True when the invitation email was accepted by the mail server. */
|
|
20073
|
-
emailed: external_exports.boolean().default(false)
|
|
20074
|
-
});
|
|
20075
|
-
var ListInvitesResponse = external_exports.object({ invites: external_exports.array(Invite) });
|
|
20076
|
-
var UpdateMemberRoleRequest = external_exports.object({ role: OrgRole });
|
|
20077
|
-
var ConnectorKind = external_exports.enum([
|
|
20078
|
-
"github",
|
|
20079
|
-
"slack",
|
|
20080
|
-
"linear",
|
|
20081
|
-
"zendesk",
|
|
20082
|
-
"jira",
|
|
20083
|
-
"email",
|
|
20084
|
-
"mcp"
|
|
20085
|
-
]);
|
|
20086
|
-
var ConnectorCatalogEntry = external_exports.object({
|
|
20087
|
-
kind: ConnectorKind,
|
|
20088
|
-
name: external_exports.string(),
|
|
20089
|
-
description: external_exports.string(),
|
|
20090
|
-
status: external_exports.enum(["available", "coming_soon"])
|
|
20091
|
-
});
|
|
20092
|
-
var ConnectionsCatalogResponse = external_exports.object({
|
|
20093
|
-
catalog: external_exports.array(ConnectorCatalogEntry),
|
|
20094
|
-
connections: external_exports.array(
|
|
20095
|
-
external_exports.object({ id: MemberId.or(external_exports.string()), kind: ConnectorKind, name: external_exports.string() })
|
|
20096
|
-
)
|
|
20097
|
-
});
|
|
20098
|
-
|
|
20099
20134
|
// ../../packages/contracts/src/secrets-env.ts
|
|
20100
20135
|
var BLOCKED_SECRET_ENV = /* @__PURE__ */ new Set([
|
|
20101
20136
|
"NODE_OPTIONS",
|
|
@@ -20499,7 +20534,7 @@ async function generateTaskTitle(instructions, runner) {
|
|
|
20499
20534
|
instructions.slice(0, INSTRUCTIONS_BUDGET),
|
|
20500
20535
|
"</task_request>"
|
|
20501
20536
|
].join("\n");
|
|
20502
|
-
return new Promise((
|
|
20537
|
+
return new Promise((resolve17) => {
|
|
20503
20538
|
const child = spawnCli(
|
|
20504
20539
|
command,
|
|
20505
20540
|
[
|
|
@@ -20522,7 +20557,7 @@ async function generateTaskTitle(instructions, runner) {
|
|
|
20522
20557
|
if (settled) return;
|
|
20523
20558
|
settled = true;
|
|
20524
20559
|
clearTimeout(timer);
|
|
20525
|
-
|
|
20560
|
+
resolve17(value);
|
|
20526
20561
|
};
|
|
20527
20562
|
const timer = setTimeout(() => {
|
|
20528
20563
|
child.kill();
|
|
@@ -20844,11 +20879,11 @@ function createWorkerWatchdogSendDrain() {
|
|
|
20844
20879
|
if (completed) return;
|
|
20845
20880
|
completed = true;
|
|
20846
20881
|
pending--;
|
|
20847
|
-
if (pending === 0) drained.splice(0).forEach((
|
|
20882
|
+
if (pending === 0) drained.splice(0).forEach((resolve17) => resolve17());
|
|
20848
20883
|
};
|
|
20849
20884
|
},
|
|
20850
20885
|
drain: async () => {
|
|
20851
|
-
if (pending > 0) await new Promise((
|
|
20886
|
+
if (pending > 0) await new Promise((resolve17) => drained.push(resolve17));
|
|
20852
20887
|
}
|
|
20853
20888
|
};
|
|
20854
20889
|
}
|
|
@@ -21093,7 +21128,7 @@ async function waitForOperationGrantRetry(retryAt, signal) {
|
|
|
21093
21128
|
const deadline = Date.parse(retryAt);
|
|
21094
21129
|
if (!Number.isFinite(deadline) || signal.aborted) return false;
|
|
21095
21130
|
if (deadline <= Date.now()) return true;
|
|
21096
|
-
return await new Promise((
|
|
21131
|
+
return await new Promise((resolve17) => {
|
|
21097
21132
|
let settled = false;
|
|
21098
21133
|
let timer;
|
|
21099
21134
|
const finish = (ready) => {
|
|
@@ -21101,7 +21136,7 @@ async function waitForOperationGrantRetry(retryAt, signal) {
|
|
|
21101
21136
|
settled = true;
|
|
21102
21137
|
if (timer) clearTimeout(timer);
|
|
21103
21138
|
signal.removeEventListener("abort", onAbort);
|
|
21104
|
-
|
|
21139
|
+
resolve17(ready);
|
|
21105
21140
|
};
|
|
21106
21141
|
const onAbort = () => finish(false);
|
|
21107
21142
|
const schedule = () => {
|
|
@@ -21369,22 +21404,22 @@ var HostClient = class _HostClient {
|
|
|
21369
21404
|
const unwindingAssignments = [...this.activeAssignments.values()];
|
|
21370
21405
|
for (const cancel of this.cancels.values()) cancel(stopReason);
|
|
21371
21406
|
for (const entry of this.secretGrants.values()) {
|
|
21372
|
-
for (const
|
|
21407
|
+
for (const resolve17 of entry.resolvers) resolve17({});
|
|
21373
21408
|
entry.resolvers = [];
|
|
21374
21409
|
delete entry.value;
|
|
21375
21410
|
}
|
|
21376
21411
|
for (const entry of this.connectionGrants.values()) {
|
|
21377
|
-
for (const
|
|
21412
|
+
for (const resolve17 of entry.resolvers) resolve17([]);
|
|
21378
21413
|
entry.resolvers = [];
|
|
21379
21414
|
delete entry.value;
|
|
21380
21415
|
}
|
|
21381
21416
|
for (const entry of this.providerGrants.values()) {
|
|
21382
|
-
for (const
|
|
21417
|
+
for (const resolve17 of entry.resolvers) resolve17([]);
|
|
21383
21418
|
entry.resolvers = [];
|
|
21384
21419
|
delete entry.value;
|
|
21385
21420
|
}
|
|
21386
21421
|
for (const waiters of this.approvalWaiters.values()) {
|
|
21387
|
-
for (const
|
|
21422
|
+
for (const resolve17 of waiters.values()) resolve17({ approved: false, guidance: reason });
|
|
21388
21423
|
}
|
|
21389
21424
|
for (const waiters of this.agentOpWaiters.values()) {
|
|
21390
21425
|
for (const waiter of waiters.values()) {
|
|
@@ -21410,9 +21445,9 @@ var HostClient = class _HostClient {
|
|
|
21410
21445
|
let drainTimer;
|
|
21411
21446
|
const drained = await Promise.race([
|
|
21412
21447
|
Promise.allSettled(runs).then(() => true),
|
|
21413
|
-
new Promise((
|
|
21448
|
+
new Promise((resolve17) => {
|
|
21414
21449
|
drainTimer = setTimeout(
|
|
21415
|
-
() =>
|
|
21450
|
+
() => resolve17(false),
|
|
21416
21451
|
this.opts.unwindTimeoutMs ?? _HostClient.DEFAULT_UNWIND_TIMEOUT_MS
|
|
21417
21452
|
);
|
|
21418
21453
|
drainTimer.unref?.();
|
|
@@ -21556,9 +21591,9 @@ var HostClient = class _HostClient {
|
|
|
21556
21591
|
let frameDrainTimer;
|
|
21557
21592
|
const framesDrained = await Promise.race([
|
|
21558
21593
|
frameTail.then(() => true),
|
|
21559
|
-
new Promise((
|
|
21594
|
+
new Promise((resolve17) => {
|
|
21560
21595
|
frameDrainTimer = setTimeout(
|
|
21561
|
-
() =>
|
|
21596
|
+
() => resolve17(false),
|
|
21562
21597
|
this.opts.unwindTimeoutMs ?? _HostClient.DEFAULT_UNWIND_TIMEOUT_MS
|
|
21563
21598
|
);
|
|
21564
21599
|
frameDrainTimer.unref?.();
|
|
@@ -22102,7 +22137,7 @@ var HostClient = class _HostClient {
|
|
|
22102
22137
|
const entry = this.secretGrants.get(key) ?? { resolvers: [] };
|
|
22103
22138
|
entry.value = message.secrets;
|
|
22104
22139
|
entry.expiresAt = expiresAt;
|
|
22105
|
-
for (const
|
|
22140
|
+
for (const resolve17 of entry.resolvers) resolve17(message.secrets);
|
|
22106
22141
|
entry.resolvers = [];
|
|
22107
22142
|
this.secretGrants.set(key, entry);
|
|
22108
22143
|
return;
|
|
@@ -22133,13 +22168,13 @@ var HostClient = class _HostClient {
|
|
|
22133
22168
|
const entry = this.connectionGrants.get(key) ?? { resolvers: [] };
|
|
22134
22169
|
entry.value = message.connections;
|
|
22135
22170
|
entry.expiresAt = expiresAt;
|
|
22136
|
-
for (const
|
|
22171
|
+
for (const resolve17 of entry.resolvers) resolve17(message.connections);
|
|
22137
22172
|
entry.resolvers = [];
|
|
22138
22173
|
this.connectionGrants.set(key, entry);
|
|
22139
22174
|
const providerEntry = this.providerGrants.get(key) ?? { resolvers: [] };
|
|
22140
22175
|
providerEntry.value = providers;
|
|
22141
22176
|
providerEntry.expiresAt = authorityExpiresAt;
|
|
22142
|
-
for (const
|
|
22177
|
+
for (const resolve17 of providerEntry.resolvers) resolve17(providers);
|
|
22143
22178
|
providerEntry.resolvers = [];
|
|
22144
22179
|
this.providerGrants.set(key, providerEntry);
|
|
22145
22180
|
return;
|
|
@@ -22273,8 +22308,8 @@ var HostClient = class _HostClient {
|
|
|
22273
22308
|
return redactCredentialText(text, sensitiveSnapshot()).slice(0, maxLength);
|
|
22274
22309
|
};
|
|
22275
22310
|
let resolveCancelled;
|
|
22276
|
-
const cancelledPromise = new Promise((
|
|
22277
|
-
resolveCancelled =
|
|
22311
|
+
const cancelledPromise = new Promise((resolve17) => {
|
|
22312
|
+
resolveCancelled = resolve17;
|
|
22278
22313
|
});
|
|
22279
22314
|
const endAuthority = (reason = "cloud_cancel") => {
|
|
22280
22315
|
if (stopReason) return;
|
|
@@ -22283,21 +22318,21 @@ var HostClient = class _HostClient {
|
|
|
22283
22318
|
authorityController.abort(reason);
|
|
22284
22319
|
const secretEntry = this.secretGrants.get(cancelKey);
|
|
22285
22320
|
if (secretEntry) {
|
|
22286
|
-
for (const
|
|
22321
|
+
for (const resolve17 of secretEntry.resolvers) resolve17({});
|
|
22287
22322
|
secretEntry.resolvers = [];
|
|
22288
22323
|
delete secretEntry.value;
|
|
22289
22324
|
}
|
|
22290
22325
|
this.secretGrants.delete(cancelKey);
|
|
22291
22326
|
const connectionEntry = this.connectionGrants.get(cancelKey);
|
|
22292
22327
|
if (connectionEntry) {
|
|
22293
|
-
for (const
|
|
22328
|
+
for (const resolve17 of connectionEntry.resolvers) resolve17([]);
|
|
22294
22329
|
connectionEntry.resolvers = [];
|
|
22295
22330
|
delete connectionEntry.value;
|
|
22296
22331
|
}
|
|
22297
22332
|
this.connectionGrants.delete(cancelKey);
|
|
22298
22333
|
const providerEntry = this.providerGrants.get(cancelKey);
|
|
22299
22334
|
if (providerEntry) {
|
|
22300
|
-
for (const
|
|
22335
|
+
for (const resolve17 of providerEntry.resolvers) resolve17([]);
|
|
22301
22336
|
providerEntry.resolvers = [];
|
|
22302
22337
|
delete providerEntry.value;
|
|
22303
22338
|
}
|
|
@@ -22305,8 +22340,8 @@ var HostClient = class _HostClient {
|
|
|
22305
22340
|
this.clearAuthorityExpiry(cancelKey);
|
|
22306
22341
|
const approvalWaiters = this.approvalWaiters.get(cancelKey);
|
|
22307
22342
|
if (approvalWaiters) {
|
|
22308
|
-
for (const
|
|
22309
|
-
|
|
22343
|
+
for (const resolve17 of approvalWaiters.values()) {
|
|
22344
|
+
resolve17({ approved: false, guidance: "task was cancelled" });
|
|
22310
22345
|
}
|
|
22311
22346
|
approvalWaiters.clear();
|
|
22312
22347
|
}
|
|
@@ -22432,9 +22467,9 @@ var HostClient = class _HostClient {
|
|
|
22432
22467
|
return value;
|
|
22433
22468
|
};
|
|
22434
22469
|
if (entry.value) return Promise.resolve(capture(entry.value));
|
|
22435
|
-
return new Promise((
|
|
22436
|
-
entry.resolvers.push((value) =>
|
|
22437
|
-
setTimeout(() =>
|
|
22470
|
+
return new Promise((resolve17) => {
|
|
22471
|
+
entry.resolvers.push((value) => resolve17(capture(value)));
|
|
22472
|
+
setTimeout(() => resolve17(capture(entry.value ?? {})), _HostClient.SECRETS_WAIT_MS);
|
|
22438
22473
|
});
|
|
22439
22474
|
};
|
|
22440
22475
|
const connections = () => {
|
|
@@ -22451,9 +22486,9 @@ var HostClient = class _HostClient {
|
|
|
22451
22486
|
return value;
|
|
22452
22487
|
};
|
|
22453
22488
|
if (entry.value) return Promise.resolve(capture(entry.value));
|
|
22454
|
-
return new Promise((
|
|
22455
|
-
entry.resolvers.push((value) =>
|
|
22456
|
-
setTimeout(() =>
|
|
22489
|
+
return new Promise((resolve17) => {
|
|
22490
|
+
entry.resolvers.push((value) => resolve17(capture(value)));
|
|
22491
|
+
setTimeout(() => resolve17(capture(entry.value ?? [])), _HostClient.SECRETS_WAIT_MS);
|
|
22457
22492
|
});
|
|
22458
22493
|
};
|
|
22459
22494
|
const providers = () => {
|
|
@@ -22470,9 +22505,9 @@ var HostClient = class _HostClient {
|
|
|
22470
22505
|
return value;
|
|
22471
22506
|
};
|
|
22472
22507
|
if (entry.value !== void 0) return Promise.resolve(capture(entry.value));
|
|
22473
|
-
return new Promise((
|
|
22474
|
-
entry.resolvers.push((value) =>
|
|
22475
|
-
setTimeout(() =>
|
|
22508
|
+
return new Promise((resolve17) => {
|
|
22509
|
+
entry.resolvers.push((value) => resolve17(capture(value)));
|
|
22510
|
+
setTimeout(() => resolve17(capture(entry.value ?? [])), _HostClient.SECRETS_WAIT_MS);
|
|
22476
22511
|
});
|
|
22477
22512
|
};
|
|
22478
22513
|
const linear = async () => {
|
|
@@ -22498,13 +22533,13 @@ var HostClient = class _HostClient {
|
|
|
22498
22533
|
payload: safe(payload, 5e4),
|
|
22499
22534
|
...questionChoices ? { questionChoices: [...questionChoices] } : {}
|
|
22500
22535
|
});
|
|
22501
|
-
return new Promise((
|
|
22536
|
+
return new Promise((resolve17) => {
|
|
22502
22537
|
const waiters = this.approvalWaiters.get(cancelKey) ?? /* @__PURE__ */ new Map();
|
|
22503
22538
|
this.approvalWaiters.set(cancelKey, waiters);
|
|
22504
|
-
waiters.set(requestId,
|
|
22539
|
+
waiters.set(requestId, resolve17);
|
|
22505
22540
|
void cancelledPromise.then(() => {
|
|
22506
22541
|
if (waiters.delete(requestId)) {
|
|
22507
|
-
|
|
22542
|
+
resolve17({ approved: false, guidance: "task was cancelled" });
|
|
22508
22543
|
}
|
|
22509
22544
|
});
|
|
22510
22545
|
});
|
|
@@ -22550,11 +22585,11 @@ var HostClient = class _HostClient {
|
|
|
22550
22585
|
if (existing) message = existing;
|
|
22551
22586
|
else terminalMessages.set(requestId, message);
|
|
22552
22587
|
}
|
|
22553
|
-
return new Promise((
|
|
22588
|
+
return new Promise((resolve17) => {
|
|
22554
22589
|
const waiters = this.agentOpWaiters.get(cancelKey) ?? /* @__PURE__ */ new Map();
|
|
22555
22590
|
this.agentOpWaiters.set(cancelKey, waiters);
|
|
22556
22591
|
if (waiters.has(requestId)) {
|
|
22557
|
-
|
|
22592
|
+
resolve17({ ok: false, error: "provider settlement request is already in flight" });
|
|
22558
22593
|
return;
|
|
22559
22594
|
}
|
|
22560
22595
|
const timer = setTimeout(() => {
|
|
@@ -22565,7 +22600,7 @@ var HostClient = class _HostClient {
|
|
|
22565
22600
|
(pending) => !(pending.type === "agent.op" && pending.requestId === requestId)
|
|
22566
22601
|
);
|
|
22567
22602
|
}
|
|
22568
|
-
|
|
22603
|
+
resolve17({
|
|
22569
22604
|
ok: false,
|
|
22570
22605
|
error: terminal ? "The provider call completed, but Zixt could not record its outcome. Do not retry; wait for reconciliation." : "the platform did not answer in time; verify with a list_* tool before retrying a mutating call"
|
|
22571
22606
|
});
|
|
@@ -22573,7 +22608,7 @@ var HostClient = class _HostClient {
|
|
|
22573
22608
|
}, _HostClient.AGENT_OP_TIMEOUT_MS);
|
|
22574
22609
|
timer.unref?.();
|
|
22575
22610
|
waiters.set(requestId, {
|
|
22576
|
-
resolve:
|
|
22611
|
+
resolve: resolve17,
|
|
22577
22612
|
timer,
|
|
22578
22613
|
...terminal ? { terminalMessage: message } : {}
|
|
22579
22614
|
});
|
|
@@ -22619,12 +22654,12 @@ var HostClient = class _HostClient {
|
|
|
22619
22654
|
"No GitHub change was attempted; the authority grant request was invalid."
|
|
22620
22655
|
);
|
|
22621
22656
|
}
|
|
22622
|
-
const outcome = await new Promise((
|
|
22657
|
+
const outcome = await new Promise((resolve17) => {
|
|
22623
22658
|
const timer = setTimeout(() => {
|
|
22624
22659
|
const waiter = this.operationGrantWaiters.get(requestId);
|
|
22625
22660
|
if (!waiter) return;
|
|
22626
22661
|
this.operationGrantWaiters.delete(requestId);
|
|
22627
|
-
|
|
22662
|
+
resolve17({ grant: null, retryable: true, reason: "no_reply_from_zixt" });
|
|
22628
22663
|
}, this.operationGrantTimeoutMs);
|
|
22629
22664
|
timer.unref?.();
|
|
22630
22665
|
this.operationGrantWaiters.set(requestId, {
|
|
@@ -22637,9 +22672,9 @@ var HostClient = class _HostClient {
|
|
|
22637
22672
|
timer,
|
|
22638
22673
|
accept: (grant) => {
|
|
22639
22674
|
addSensitiveValues(providerGrantSensitiveValues(grant));
|
|
22640
|
-
|
|
22675
|
+
resolve17({ grant });
|
|
22641
22676
|
},
|
|
22642
|
-
deny: (retryable, reason, detail, retryAt, retryCode) =>
|
|
22677
|
+
deny: (retryable, reason, detail, retryAt, retryCode) => resolve17({
|
|
22643
22678
|
grant: null,
|
|
22644
22679
|
retryable,
|
|
22645
22680
|
reason,
|
|
@@ -22653,7 +22688,7 @@ var HostClient = class _HostClient {
|
|
|
22653
22688
|
} catch {
|
|
22654
22689
|
clearTimeout(timer);
|
|
22655
22690
|
this.operationGrantWaiters.delete(requestId);
|
|
22656
|
-
|
|
22691
|
+
resolve17({ grant: null, retryable: false, reason: "connection_unavailable" });
|
|
22657
22692
|
}
|
|
22658
22693
|
});
|
|
22659
22694
|
if (outcome.grant) {
|
|
@@ -22709,7 +22744,7 @@ var HostClient = class _HostClient {
|
|
|
22709
22744
|
)
|
|
22710
22745
|
);
|
|
22711
22746
|
}
|
|
22712
|
-
return new Promise((
|
|
22747
|
+
return new Promise((resolve17, reject3) => {
|
|
22713
22748
|
const timer = setTimeout(() => {
|
|
22714
22749
|
if (this.browserCredentialWaiters.delete(requestId)) {
|
|
22715
22750
|
reject3(
|
|
@@ -22728,7 +22763,7 @@ var HostClient = class _HostClient {
|
|
|
22728
22763
|
timer,
|
|
22729
22764
|
accept: (credential) => {
|
|
22730
22765
|
addSensitiveValues(webLoginSensitiveValues(credential));
|
|
22731
|
-
|
|
22766
|
+
resolve17(credential);
|
|
22732
22767
|
},
|
|
22733
22768
|
deny: (reason) => reject3(new Error(reason))
|
|
22734
22769
|
});
|
|
@@ -23049,14 +23084,14 @@ async function observeWindowsGuardianNonce(pid, nonce) {
|
|
|
23049
23084
|
"Windows runner identity could not be observed"
|
|
23050
23085
|
);
|
|
23051
23086
|
}
|
|
23052
|
-
return new Promise((
|
|
23087
|
+
return new Promise((resolve17, reject3) => {
|
|
23053
23088
|
let done = false;
|
|
23054
23089
|
const finish = (result) => {
|
|
23055
23090
|
if (done) return;
|
|
23056
23091
|
done = true;
|
|
23057
23092
|
clearTimeout(timeout);
|
|
23058
23093
|
if (result instanceof Error) reject3(result);
|
|
23059
|
-
else
|
|
23094
|
+
else resolve17(result);
|
|
23060
23095
|
};
|
|
23061
23096
|
const timeout = setTimeout(
|
|
23062
23097
|
() => finish(
|
|
@@ -23101,7 +23136,7 @@ async function observePosixGuardianNonce(pid, nonce) {
|
|
|
23101
23136
|
);
|
|
23102
23137
|
}
|
|
23103
23138
|
}
|
|
23104
|
-
return new Promise((
|
|
23139
|
+
return new Promise((resolve17, reject3) => {
|
|
23105
23140
|
const observer = spawn2("/bin/ps", ["-ww", "-o", "command=", "-p", String(pid)], {
|
|
23106
23141
|
stdio: ["ignore", "pipe", "ignore"]
|
|
23107
23142
|
});
|
|
@@ -23112,7 +23147,7 @@ async function observePosixGuardianNonce(pid, nonce) {
|
|
|
23112
23147
|
done = true;
|
|
23113
23148
|
clearTimeout(timeout);
|
|
23114
23149
|
if (result instanceof Error) reject3(result);
|
|
23115
|
-
else
|
|
23150
|
+
else resolve17(result);
|
|
23116
23151
|
};
|
|
23117
23152
|
const timeout = setTimeout(() => {
|
|
23118
23153
|
observer.kill("SIGKILL");
|
|
@@ -23159,7 +23194,7 @@ async function observeGuardianIdentity(pid, identity) {
|
|
|
23159
23194
|
return process.platform === "win32" ? observeWindowsGuardianNonce(pid, identity.nonce) : observePosixGuardianNonce(pid, identity.nonce);
|
|
23160
23195
|
}
|
|
23161
23196
|
function delay(ms) {
|
|
23162
|
-
return new Promise((
|
|
23197
|
+
return new Promise((resolve17) => setTimeout(resolve17, ms));
|
|
23163
23198
|
}
|
|
23164
23199
|
function posixProcessRecordsFromPs(output) {
|
|
23165
23200
|
const records = [];
|
|
@@ -23192,7 +23227,7 @@ function posixProcessRecordsFromPs(output) {
|
|
|
23192
23227
|
return records;
|
|
23193
23228
|
}
|
|
23194
23229
|
async function snapshotPosixProcesses() {
|
|
23195
|
-
return new Promise((
|
|
23230
|
+
return new Promise((resolve17, reject3) => {
|
|
23196
23231
|
const observer = spawn2("/bin/ps", ["-axo", "uid=,pid=,ppid=,pgid=,stat="], {
|
|
23197
23232
|
stdio: ["ignore", "pipe", "ignore"]
|
|
23198
23233
|
});
|
|
@@ -23205,7 +23240,7 @@ async function snapshotPosixProcesses() {
|
|
|
23205
23240
|
if (error52) reject3(error52);
|
|
23206
23241
|
else {
|
|
23207
23242
|
try {
|
|
23208
|
-
|
|
23243
|
+
resolve17(posixProcessRecordsFromPs(output));
|
|
23209
23244
|
} catch (caught) {
|
|
23210
23245
|
reject3(caught);
|
|
23211
23246
|
}
|
|
@@ -23540,7 +23575,7 @@ async function snapshotWindowsDescendants(rootPid) {
|
|
|
23540
23575
|
"Windows process-tree observation could not start"
|
|
23541
23576
|
);
|
|
23542
23577
|
}
|
|
23543
|
-
return new Promise((
|
|
23578
|
+
return new Promise((resolve17, reject3) => {
|
|
23544
23579
|
let done = false;
|
|
23545
23580
|
const timeout = setTimeout(() => {
|
|
23546
23581
|
if (done) return;
|
|
@@ -23567,7 +23602,7 @@ async function snapshotWindowsDescendants(rootPid) {
|
|
|
23567
23602
|
return;
|
|
23568
23603
|
}
|
|
23569
23604
|
try {
|
|
23570
|
-
|
|
23605
|
+
resolve17(completeWindowsDescendantPids(rootPid, processes));
|
|
23571
23606
|
} catch (caught) {
|
|
23572
23607
|
reject3(caught);
|
|
23573
23608
|
}
|
|
@@ -23614,7 +23649,7 @@ async function waitForProcessesExit(pids, timeoutMs) {
|
|
|
23614
23649
|
}
|
|
23615
23650
|
async function runTaskkill(pid, command, timeoutMs = TASKKILL_TIMEOUT_MS, independentlyTrackedPids = []) {
|
|
23616
23651
|
const trustedCommand = command ?? defaultTaskkillCommand();
|
|
23617
|
-
const result = await new Promise((
|
|
23652
|
+
const result = await new Promise((resolve17, reject3) => {
|
|
23618
23653
|
const killer = spawn2(trustedCommand, ["/PID", String(pid), "/T", "/F"], {
|
|
23619
23654
|
stdio: ["ignore", "pipe", "pipe"],
|
|
23620
23655
|
windowsHide: true
|
|
@@ -23649,7 +23684,7 @@ async function runTaskkill(pid, command, timeoutMs = TASKKILL_TIMEOUT_MS, indepe
|
|
|
23649
23684
|
done = true;
|
|
23650
23685
|
clearTimeout(timeout);
|
|
23651
23686
|
if (error52) reject3(error52);
|
|
23652
|
-
else
|
|
23687
|
+
else resolve17({ code: killer.exitCode, output, outputTruncated });
|
|
23653
23688
|
};
|
|
23654
23689
|
killer.once(
|
|
23655
23690
|
"error",
|
|
@@ -24326,12 +24361,12 @@ async function createWindowsJobContainment(pid, options) {
|
|
|
24326
24361
|
stderr = `${stderr}${String(chunk)}`.slice(-HELPER_OUTPUT_LIMIT);
|
|
24327
24362
|
});
|
|
24328
24363
|
const helperEvents = helper;
|
|
24329
|
-
const exited = new Promise((
|
|
24364
|
+
const exited = new Promise((resolve17) => {
|
|
24330
24365
|
let completed = false;
|
|
24331
24366
|
const complete = (code, signal) => {
|
|
24332
24367
|
if (completed) return;
|
|
24333
24368
|
completed = true;
|
|
24334
|
-
|
|
24369
|
+
resolve17({ code, signal });
|
|
24335
24370
|
};
|
|
24336
24371
|
helperEvents.once("error", () => {
|
|
24337
24372
|
failProtocol(new Error("Windows Job Object helper could not start"));
|
|
@@ -24344,7 +24379,7 @@ async function createWindowsJobContainment(pid, options) {
|
|
|
24344
24379
|
});
|
|
24345
24380
|
const nextLine = async (expected) => {
|
|
24346
24381
|
if (protocolFailure) throw protocolFailure;
|
|
24347
|
-
const line = lines.shift() ?? await new Promise((
|
|
24382
|
+
const line = lines.shift() ?? await new Promise((resolve17, reject3) => {
|
|
24348
24383
|
const timer = setTimeout(
|
|
24349
24384
|
() => reject3(timeoutError("Windows Job Object helper did not answer in time")),
|
|
24350
24385
|
timeoutMs
|
|
@@ -24352,7 +24387,7 @@ async function createWindowsJobContainment(pid, options) {
|
|
|
24352
24387
|
timer.unref?.();
|
|
24353
24388
|
lineWaiters.push((value) => {
|
|
24354
24389
|
clearTimeout(timer);
|
|
24355
|
-
|
|
24390
|
+
resolve17(value);
|
|
24356
24391
|
});
|
|
24357
24392
|
});
|
|
24358
24393
|
if (protocolFailure) throw protocolFailure;
|
|
@@ -24365,8 +24400,8 @@ async function createWindowsJobContainment(pid, options) {
|
|
|
24365
24400
|
}
|
|
24366
24401
|
const stopped = await Promise.race([
|
|
24367
24402
|
exited.then(() => true),
|
|
24368
|
-
new Promise((
|
|
24369
|
-
const timer = setTimeout(() =>
|
|
24403
|
+
new Promise((resolve17) => {
|
|
24404
|
+
const timer = setTimeout(() => resolve17(false), timeoutMs);
|
|
24370
24405
|
timer.unref?.();
|
|
24371
24406
|
})
|
|
24372
24407
|
]);
|
|
@@ -24425,7 +24460,7 @@ async function awaitWindowsContainmentGate(env = process.env, input = process.st
|
|
|
24425
24460
|
if (nonce === void 0) return true;
|
|
24426
24461
|
if (!SAFE_NONCE2.test(nonce)) return false;
|
|
24427
24462
|
const expected = windowsContainmentGate(nonce).trimEnd();
|
|
24428
|
-
return new Promise((
|
|
24463
|
+
return new Promise((resolve17) => {
|
|
24429
24464
|
let pending = Buffer.alloc(0);
|
|
24430
24465
|
let settled = false;
|
|
24431
24466
|
const finish = (result) => {
|
|
@@ -24436,7 +24471,7 @@ async function awaitWindowsContainmentGate(env = process.env, input = process.st
|
|
|
24436
24471
|
input.off("end", onEnd);
|
|
24437
24472
|
input.off("error", onEnd);
|
|
24438
24473
|
if (result) input.pause();
|
|
24439
|
-
|
|
24474
|
+
resolve17(result);
|
|
24440
24475
|
};
|
|
24441
24476
|
const onData = (chunk) => {
|
|
24442
24477
|
pending = Buffer.concat([pending, chunk]);
|
|
@@ -24861,7 +24896,7 @@ async function installRelease(version2, options = {}) {
|
|
|
24861
24896
|
installerContainmentSetupError = error52;
|
|
24862
24897
|
return null;
|
|
24863
24898
|
}) : Promise.resolve(null);
|
|
24864
|
-
const installed = await new Promise((
|
|
24899
|
+
const installed = await new Promise((resolve17, reject3) => {
|
|
24865
24900
|
let finished = false;
|
|
24866
24901
|
let cleanupStarted = false;
|
|
24867
24902
|
let exitObserved = false;
|
|
@@ -24877,7 +24912,7 @@ async function installRelease(version2, options = {}) {
|
|
|
24877
24912
|
finished = true;
|
|
24878
24913
|
clearTimeout(timer);
|
|
24879
24914
|
options.signal?.removeEventListener("abort", requestCleanup);
|
|
24880
|
-
|
|
24915
|
+
resolve17(result);
|
|
24881
24916
|
};
|
|
24882
24917
|
const requestCleanup = () => {
|
|
24883
24918
|
if (cleanupStarted || finished) return;
|
|
@@ -25190,11 +25225,11 @@ async function runWorkerCompatibilityProxy(env = process.env, argv = process.arg
|
|
|
25190
25225
|
child.stdin?.on("error", () => {
|
|
25191
25226
|
});
|
|
25192
25227
|
process.stdin.pipe(child.stdin);
|
|
25193
|
-
return new Promise((
|
|
25194
|
-
child.once("error", () =>
|
|
25228
|
+
return new Promise((resolve17) => {
|
|
25229
|
+
child.once("error", () => resolve17(1));
|
|
25195
25230
|
child.once("exit", (code) => {
|
|
25196
25231
|
process.stdin.unpipe(child.stdin);
|
|
25197
|
-
|
|
25232
|
+
resolve17(code ?? 1);
|
|
25198
25233
|
});
|
|
25199
25234
|
});
|
|
25200
25235
|
}
|
|
@@ -25273,11 +25308,11 @@ async function launchHostSupervisor(options = {}) {
|
|
|
25273
25308
|
const waitOrStop = async (ms) => {
|
|
25274
25309
|
if (stopping) return false;
|
|
25275
25310
|
if (!customDelay) {
|
|
25276
|
-
await new Promise((
|
|
25311
|
+
await new Promise((resolve17) => {
|
|
25277
25312
|
const finish = () => {
|
|
25278
25313
|
clearTimeout(timer);
|
|
25279
25314
|
stopController.signal.removeEventListener("abort", finish);
|
|
25280
|
-
|
|
25315
|
+
resolve17();
|
|
25281
25316
|
};
|
|
25282
25317
|
const timer = setTimeout(finish, ms);
|
|
25283
25318
|
stopController.signal.addEventListener("abort", finish, { once: true });
|
|
@@ -25285,8 +25320,8 @@ async function launchHostSupervisor(options = {}) {
|
|
|
25285
25320
|
return !stopping;
|
|
25286
25321
|
}
|
|
25287
25322
|
let finishStop;
|
|
25288
|
-
const stopped = new Promise((
|
|
25289
|
-
finishStop = () =>
|
|
25323
|
+
const stopped = new Promise((resolve17) => {
|
|
25324
|
+
finishStop = () => resolve17();
|
|
25290
25325
|
stopController.signal.addEventListener("abort", finishStop, { once: true });
|
|
25291
25326
|
});
|
|
25292
25327
|
await Promise.race([customDelay(ms), stopped]);
|
|
@@ -25412,19 +25447,19 @@ async function launchHostSupervisor(options = {}) {
|
|
|
25412
25447
|
child = spawnSupervisor(entry, version2, ownershipDirectory, containmentGateNonce);
|
|
25413
25448
|
const launchedSupervisor = child;
|
|
25414
25449
|
let resolveChildExited;
|
|
25415
|
-
const childExited = new Promise((
|
|
25416
|
-
resolveChildExited =
|
|
25450
|
+
const childExited = new Promise((resolve17) => {
|
|
25451
|
+
resolveChildExited = resolve17;
|
|
25417
25452
|
});
|
|
25418
25453
|
const supervisorContainmentAbort = new AbortController();
|
|
25419
25454
|
void childExited.then(() => supervisorContainmentAbort.abort());
|
|
25420
25455
|
const outcomePromise = new Promise(
|
|
25421
|
-
(
|
|
25456
|
+
(resolve17) => {
|
|
25422
25457
|
let observed = false;
|
|
25423
25458
|
const finish = (code, signal) => {
|
|
25424
25459
|
if (observed) return;
|
|
25425
25460
|
observed = true;
|
|
25426
25461
|
resolveChildExited();
|
|
25427
|
-
|
|
25462
|
+
resolve17({ code, signal });
|
|
25428
25463
|
};
|
|
25429
25464
|
child.once("error", () => finish(1, null));
|
|
25430
25465
|
child.once("exit", finish);
|
|
@@ -25445,12 +25480,12 @@ async function launchHostSupervisor(options = {}) {
|
|
|
25445
25480
|
if (!supervisorContainment || !launchedSupervisor.stdin) {
|
|
25446
25481
|
throw new Error("supervisor Job Object gate is unavailable");
|
|
25447
25482
|
}
|
|
25448
|
-
await new Promise((
|
|
25483
|
+
await new Promise((resolve17, reject3) => {
|
|
25449
25484
|
launchedSupervisor.stdin.write(
|
|
25450
25485
|
windowsContainmentGate(containmentGateNonce),
|
|
25451
25486
|
(error52) => {
|
|
25452
25487
|
if (error52) reject3(error52);
|
|
25453
|
-
else
|
|
25488
|
+
else resolve17();
|
|
25454
25489
|
}
|
|
25455
25490
|
);
|
|
25456
25491
|
});
|
|
@@ -25592,18 +25627,18 @@ async function superviseHost(options = {}) {
|
|
|
25592
25627
|
}
|
|
25593
25628
|
}
|
|
25594
25629
|
let announceShutdown;
|
|
25595
|
-
const shutdownAnnounced = new Promise((
|
|
25596
|
-
announceShutdown =
|
|
25630
|
+
const shutdownAnnounced = new Promise((resolve17) => {
|
|
25631
|
+
announceShutdown = resolve17;
|
|
25597
25632
|
});
|
|
25598
25633
|
const attempted = /* @__PURE__ */ new Set();
|
|
25599
25634
|
const waitOrShutdown = async (ms) => {
|
|
25600
25635
|
if (shuttingDown2) return false;
|
|
25601
25636
|
if (!customDelay) {
|
|
25602
|
-
await new Promise((
|
|
25637
|
+
await new Promise((resolve17) => {
|
|
25603
25638
|
const finish = () => {
|
|
25604
25639
|
clearTimeout(timer);
|
|
25605
25640
|
shutdownController.signal.removeEventListener("abort", finish);
|
|
25606
|
-
|
|
25641
|
+
resolve17();
|
|
25607
25642
|
};
|
|
25608
25643
|
const timer = setTimeout(finish, ms);
|
|
25609
25644
|
shutdownController.signal.addEventListener("abort", finish, { once: true });
|
|
@@ -25746,19 +25781,19 @@ async function superviseHost(options = {}) {
|
|
|
25746
25781
|
child = spawnWorker(command, watchdogLaunch, compatibilityOwnership, containmentGateNonce);
|
|
25747
25782
|
const watchedChild = child;
|
|
25748
25783
|
let resolveChildExited;
|
|
25749
|
-
const childExited = new Promise((
|
|
25750
|
-
resolveChildExited =
|
|
25784
|
+
const childExited = new Promise((resolve17) => {
|
|
25785
|
+
resolveChildExited = resolve17;
|
|
25751
25786
|
});
|
|
25752
25787
|
const workerContainmentAbort = new AbortController();
|
|
25753
25788
|
void childExited.then(() => workerContainmentAbort.abort());
|
|
25754
25789
|
const outcomePromise = new Promise(
|
|
25755
|
-
(
|
|
25790
|
+
(resolve17) => {
|
|
25756
25791
|
let observed = false;
|
|
25757
25792
|
const finish = (result) => {
|
|
25758
25793
|
if (observed) return;
|
|
25759
25794
|
observed = true;
|
|
25760
25795
|
resolveChildExited();
|
|
25761
|
-
|
|
25796
|
+
resolve17(result);
|
|
25762
25797
|
};
|
|
25763
25798
|
watchedChild.once("error", () => finish({ code: 1, signal: null }));
|
|
25764
25799
|
watchedChild.once(
|
|
@@ -25780,10 +25815,10 @@ async function superviseHost(options = {}) {
|
|
|
25780
25815
|
if (!workerContainment || !watchedChild.stdin) {
|
|
25781
25816
|
throw new Error("worker Job Object gate is unavailable");
|
|
25782
25817
|
}
|
|
25783
|
-
await new Promise((
|
|
25818
|
+
await new Promise((resolve17, reject3) => {
|
|
25784
25819
|
watchedChild.stdin.write(windowsContainmentGate(containmentGateNonce), (error52) => {
|
|
25785
25820
|
if (error52) reject3(error52);
|
|
25786
|
-
else
|
|
25821
|
+
else resolve17();
|
|
25787
25822
|
});
|
|
25788
25823
|
});
|
|
25789
25824
|
}
|
|
@@ -26047,7 +26082,47 @@ async function superviseHost(options = {}) {
|
|
|
26047
26082
|
}
|
|
26048
26083
|
|
|
26049
26084
|
// src/index.ts
|
|
26050
|
-
import { hostname as hostname3 } from "node:os";
|
|
26085
|
+
import { homedir as homedir12, hostname as hostname3 } from "node:os";
|
|
26086
|
+
|
|
26087
|
+
// src/hardware.ts
|
|
26088
|
+
import { existsSync } from "node:fs";
|
|
26089
|
+
import { statfs } from "node:fs/promises";
|
|
26090
|
+
import { cpus, freemem, homedir as homedir2, totalmem } from "node:os";
|
|
26091
|
+
import { dirname as dirname4, resolve as resolve5 } from "node:path";
|
|
26092
|
+
async function machineHardware(workRoot = homedir2()) {
|
|
26093
|
+
return {
|
|
26094
|
+
// A container or cgroup can hide processors from this count; it is what
|
|
26095
|
+
// this process can see, which is what its Tasks will actually get.
|
|
26096
|
+
cpuCount: Math.max(1, cpus().length),
|
|
26097
|
+
memoryTotalBytes: totalmem(),
|
|
26098
|
+
memoryFreeBytes: freemem(),
|
|
26099
|
+
disk: await diskSpace(workRoot)
|
|
26100
|
+
};
|
|
26101
|
+
}
|
|
26102
|
+
async function diskSpace(workRoot) {
|
|
26103
|
+
const measured = nearestExistingPath(workRoot);
|
|
26104
|
+
if (!measured) return null;
|
|
26105
|
+
try {
|
|
26106
|
+
const stats = await statfs(measured);
|
|
26107
|
+
const blockSize = Number(stats.bsize);
|
|
26108
|
+
const freeBytes = Number(stats.bavail) * blockSize;
|
|
26109
|
+
const totalBytes = Number(stats.blocks) * blockSize;
|
|
26110
|
+
if (!Number.isSafeInteger(totalBytes) || !Number.isSafeInteger(freeBytes)) return null;
|
|
26111
|
+
return { path: measured, totalBytes, freeBytes: Math.min(freeBytes, totalBytes) };
|
|
26112
|
+
} catch {
|
|
26113
|
+
return null;
|
|
26114
|
+
}
|
|
26115
|
+
}
|
|
26116
|
+
function nearestExistingPath(start) {
|
|
26117
|
+
let candidate = resolve5(start);
|
|
26118
|
+
for (let depth = 0; depth < 16; depth++) {
|
|
26119
|
+
if (existsSync(candidate)) return candidate;
|
|
26120
|
+
const parent = dirname4(candidate);
|
|
26121
|
+
if (parent === candidate) return null;
|
|
26122
|
+
candidate = parent;
|
|
26123
|
+
}
|
|
26124
|
+
return null;
|
|
26125
|
+
}
|
|
26051
26126
|
|
|
26052
26127
|
// src/browser/adapter.ts
|
|
26053
26128
|
var BROWSER_LOGIN_ORIGIN_CHANGED = "No sign-in was attempted: the browser left the approved sign-in site. Return to that site and try again.";
|
|
@@ -26237,15 +26312,15 @@ function createDemoBrowserAdapterFactory() {
|
|
|
26237
26312
|
|
|
26238
26313
|
// src/browser/manager.ts
|
|
26239
26314
|
import { lstat as lstat5, mkdir as mkdir4, open as open4, opendir, readFile as readFile6, rename as rename3, rm as rm4 } from "node:fs/promises";
|
|
26240
|
-
import { homedir as
|
|
26241
|
-
import { dirname as
|
|
26315
|
+
import { homedir as homedir3 } from "node:os";
|
|
26316
|
+
import { dirname as dirname5, join as join7, resolve as resolve6 } from "node:path";
|
|
26242
26317
|
var SAFE_SEGMENT = /^[A-Za-z0-9_-]{1,200}$/;
|
|
26243
26318
|
var FRAME_MIN_INTERVAL_MS = 100;
|
|
26244
26319
|
var IDLE_TIMEOUT_MS = 15 * 6e4;
|
|
26245
26320
|
var BrowserManager = class {
|
|
26246
26321
|
constructor(opts) {
|
|
26247
26322
|
this.opts = opts;
|
|
26248
|
-
this.profileRoot = opts.profileRoot ?? join7(
|
|
26323
|
+
this.profileRoot = opts.profileRoot ?? join7(homedir3(), ".zixt", "browser-profiles");
|
|
26249
26324
|
this.profileStateRoot = join7(this.profileRoot, ".profile-state");
|
|
26250
26325
|
this.viewport = opts.viewport ?? BROWSER_DEFAULT_VIEWPORT;
|
|
26251
26326
|
this.idleTimeoutMs = opts.idleTimeoutMs ?? IDLE_TIMEOUT_MS;
|
|
@@ -26336,9 +26411,9 @@ var BrowserManager = class {
|
|
|
26336
26411
|
}
|
|
26337
26412
|
}
|
|
26338
26413
|
exactChild(root, child) {
|
|
26339
|
-
const canonicalRoot =
|
|
26340
|
-
const target =
|
|
26341
|
-
if (
|
|
26414
|
+
const canonicalRoot = resolve6(root);
|
|
26415
|
+
const target = resolve6(canonicalRoot, child);
|
|
26416
|
+
if (dirname5(target) !== canonicalRoot) {
|
|
26342
26417
|
throw new Error("browser profile path escaped its owned root");
|
|
26343
26418
|
}
|
|
26344
26419
|
return target;
|
|
@@ -27247,8 +27322,8 @@ function createPlaywrightBrowserAdapterFactory(dependencies = {}) {
|
|
|
27247
27322
|
import { spawn as spawn8 } from "node:child_process";
|
|
27248
27323
|
import { randomUUID as randomUUID10 } from "node:crypto";
|
|
27249
27324
|
import { lstat as lstat11, mkdir as mkdir10, realpath as realpath8 } from "node:fs/promises";
|
|
27250
|
-
import { homedir as
|
|
27251
|
-
import { dirname as
|
|
27325
|
+
import { homedir as homedir5 } from "node:os";
|
|
27326
|
+
import { dirname as dirname8, isAbsolute as isAbsolute14, join as join14, resolve as resolve10 } from "node:path";
|
|
27252
27327
|
|
|
27253
27328
|
// src/tool-packs/browser/authentication-wall.ts
|
|
27254
27329
|
var AUTH_PATH_SEGMENT = /(?:^|\/)(?:log[-_]?in|sign[-_]?in|sso|saml|auth|authorize|authenticate|oauth2?|session\/new|checkpoint)(?:\/|$)/i;
|
|
@@ -29974,7 +30049,7 @@ function createGithubPushOrchestrator(input) {
|
|
|
29974
30049
|
import { spawn as spawn5 } from "node:child_process";
|
|
29975
30050
|
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
29976
30051
|
import { chmod as chmod3, lstat as lstat7, mkdir as mkdir5, realpath as realpath4, rm as rm5 } from "node:fs/promises";
|
|
29977
|
-
import { dirname as
|
|
30052
|
+
import { dirname as dirname6, isAbsolute as isAbsolute9, join as join9, relative as relative5 } from "node:path";
|
|
29978
30053
|
|
|
29979
30054
|
// src/tool-packs/github/git-credential-broker.ts
|
|
29980
30055
|
import { createServer } from "node:http";
|
|
@@ -30225,7 +30300,7 @@ async function requireRealDirectory(path, label) {
|
|
|
30225
30300
|
async function validateTokenlessPaths(command) {
|
|
30226
30301
|
if (command.kind === "clone-from-bridge") {
|
|
30227
30302
|
if (!isAbsolute9(command.destination)) throw new GithubGitProcessError("invalid_input");
|
|
30228
|
-
const parent = await requireRealDirectory(
|
|
30303
|
+
const parent = await requireRealDirectory(dirname6(command.destination), "clone parent");
|
|
30229
30304
|
assertBelow(parent, command.destination, "clone destination");
|
|
30230
30305
|
const destination = await lstat7(command.destination).catch((error52) => {
|
|
30231
30306
|
if (error52.code === "ENOENT") return null;
|
|
@@ -30335,8 +30410,8 @@ async function runGit(input, args, env) {
|
|
|
30335
30410
|
let settled = false;
|
|
30336
30411
|
let stopping = false;
|
|
30337
30412
|
let resolveExited;
|
|
30338
|
-
const exited = new Promise((
|
|
30339
|
-
resolveExited =
|
|
30413
|
+
const exited = new Promise((resolve17) => {
|
|
30414
|
+
resolveExited = resolve17;
|
|
30340
30415
|
});
|
|
30341
30416
|
child.once("exit", resolveExited);
|
|
30342
30417
|
const cleanup = () => {
|
|
@@ -30984,7 +31059,7 @@ function createRepositoryTools(runtime) {
|
|
|
30984
31059
|
// src/tool-packs/github/workspace.ts
|
|
30985
31060
|
import { randomUUID as randomUUID8 } from "node:crypto";
|
|
30986
31061
|
import { chmod as chmod4, lstat as lstat8, mkdir as mkdir6, readFile as readFile7, realpath as realpath5, rename as rename4, rm as rm6, writeFile as writeFile2 } from "node:fs/promises";
|
|
30987
|
-
import { isAbsolute as isAbsolute10, join as join10, relative as relative6, resolve as
|
|
31062
|
+
import { isAbsolute as isAbsolute10, join as join10, relative as relative6, resolve as resolve7 } from "node:path";
|
|
30988
31063
|
var SAFE_LOCAL_ID = /^[A-Za-z0-9_-]{1,200}$/;
|
|
30989
31064
|
var FULL_NAME2 = /^[A-Za-z0-9_.-]{1,100}\/[A-Za-z0-9_.-]{1,100}$/;
|
|
30990
31065
|
var DIRECTORY_MODE2 = 448;
|
|
@@ -31007,7 +31082,7 @@ function assertBelow2(parent, child, label) {
|
|
|
31007
31082
|
}
|
|
31008
31083
|
}
|
|
31009
31084
|
function samePath(left, right) {
|
|
31010
|
-
return process.platform === "win32" ?
|
|
31085
|
+
return process.platform === "win32" ? resolve7(left).toLowerCase() === resolve7(right).toLowerCase() : resolve7(left) === resolve7(right);
|
|
31011
31086
|
}
|
|
31012
31087
|
async function requireRealDirectory2(path, label) {
|
|
31013
31088
|
const entry = await lstat8(path).catch(() => null);
|
|
@@ -32824,8 +32899,8 @@ var linearToolPackFactory = {
|
|
|
32824
32899
|
async create(grant, context) {
|
|
32825
32900
|
let resolveCancelled;
|
|
32826
32901
|
let closed = false;
|
|
32827
|
-
const cancelled = new Promise((
|
|
32828
|
-
resolveCancelled =
|
|
32902
|
+
const cancelled = new Promise((resolve17) => {
|
|
32903
|
+
resolveCancelled = resolve17;
|
|
32829
32904
|
});
|
|
32830
32905
|
const cancel = () => {
|
|
32831
32906
|
if (closed) return;
|
|
@@ -33625,7 +33700,7 @@ function createAskUserServer() {
|
|
|
33625
33700
|
let server;
|
|
33626
33701
|
let listening;
|
|
33627
33702
|
function ensureListening() {
|
|
33628
|
-
listening ??= new Promise((
|
|
33703
|
+
listening ??= new Promise((resolve17, reject3) => {
|
|
33629
33704
|
server = createServer2((req, res) => {
|
|
33630
33705
|
res.on("error", () => {
|
|
33631
33706
|
});
|
|
@@ -33641,7 +33716,7 @@ function createAskUserServer() {
|
|
|
33641
33716
|
server.on("error", reject3);
|
|
33642
33717
|
server.listen(0, "127.0.0.1", () => {
|
|
33643
33718
|
const address = server.address();
|
|
33644
|
-
if (address && typeof address === "object")
|
|
33719
|
+
if (address && typeof address === "object") resolve17(address.port);
|
|
33645
33720
|
else reject3(new Error("ask_user server failed to bind"));
|
|
33646
33721
|
});
|
|
33647
33722
|
server.unref();
|
|
@@ -34665,7 +34740,7 @@ password=${credential.accessToken}
|
|
|
34665
34740
|
|
|
34666
34741
|
// src/runners/working-context.ts
|
|
34667
34742
|
import { spawn as spawn6 } from "node:child_process";
|
|
34668
|
-
import { resolve as
|
|
34743
|
+
import { resolve as resolve8 } from "node:path";
|
|
34669
34744
|
var COMMAND_TIMEOUT_MS = 5e3;
|
|
34670
34745
|
var OUTPUT_LIMIT_BYTES = 128 * 1024;
|
|
34671
34746
|
var COMMAND_STOP_TIMEOUT_MS = 2e4;
|
|
@@ -35060,8 +35135,8 @@ async function repositoryState(directory, git, env, signal) {
|
|
|
35060
35135
|
const pathLines = paths.trim().split(/\r?\n/);
|
|
35061
35136
|
if (pathLines.length < 3 || !pathLines[0] || !pathLines[1] || !pathLines[2]) return null;
|
|
35062
35137
|
const root = pathLines[0];
|
|
35063
|
-
const gitDirectory =
|
|
35064
|
-
const commonDirectory =
|
|
35138
|
+
const gitDirectory = resolve8(directory, pathLines[1]);
|
|
35139
|
+
const commonDirectory = resolve8(directory, pathLines[2]);
|
|
35065
35140
|
const records = status.split(/\0|\r?\n/).filter(Boolean);
|
|
35066
35141
|
const rawBranch = statusField(records, "branch.head");
|
|
35067
35142
|
if (!rawBranch || rawBranch.length > 512 || !isSafeSingleLineDisplayText(rawBranch)) return null;
|
|
@@ -35226,8 +35301,8 @@ import {
|
|
|
35226
35301
|
rm as rm7,
|
|
35227
35302
|
writeFile as writeFile5
|
|
35228
35303
|
} from "node:fs/promises";
|
|
35229
|
-
import { homedir as
|
|
35230
|
-
import { dirname as
|
|
35304
|
+
import { homedir as homedir4 } from "node:os";
|
|
35305
|
+
import { dirname as dirname7, isAbsolute as isAbsolute13, join as join13, relative as relative8, resolve as resolve9, sep as sep4, win32 as win322 } from "node:path";
|
|
35231
35306
|
var SAFE_SEGMENT2 = /^[A-Za-z0-9_-]{1,200}$/;
|
|
35232
35307
|
var DIRECTORY_MODE4 = 448;
|
|
35233
35308
|
var FILE_MODE3 = 384;
|
|
@@ -35444,7 +35519,7 @@ foreach ($path in $paths) {
|
|
|
35444
35519
|
}
|
|
35445
35520
|
`;
|
|
35446
35521
|
function defaultRunArtifactRoot() {
|
|
35447
|
-
return join13(
|
|
35522
|
+
return join13(homedir4(), ".zixt", "run-artifacts");
|
|
35448
35523
|
}
|
|
35449
35524
|
function requireSafeSegment(value, field) {
|
|
35450
35525
|
if (!SAFE_SEGMENT2.test(value)) {
|
|
@@ -35488,10 +35563,10 @@ async function rejectWindowsSymlinkAncestors(profile, target) {
|
|
|
35488
35563
|
}
|
|
35489
35564
|
}
|
|
35490
35565
|
async function prepareRoot(root) {
|
|
35491
|
-
const absolute =
|
|
35566
|
+
const absolute = resolve9(root);
|
|
35492
35567
|
let realProfile;
|
|
35493
35568
|
if (process.platform === "win32") {
|
|
35494
|
-
const profile =
|
|
35569
|
+
const profile = resolve9(homedir4());
|
|
35495
35570
|
assertWindowsProfileBoundary(profile, absolute);
|
|
35496
35571
|
await rejectWindowsSymlinkAncestors(profile, absolute);
|
|
35497
35572
|
realProfile = await realpath7(profile);
|
|
@@ -35661,10 +35736,10 @@ async function removePrivateTreeWithRetries(path, removeTree, retryDelayMs) {
|
|
|
35661
35736
|
}
|
|
35662
35737
|
}
|
|
35663
35738
|
async function sweepOrphanedRunArtifacts(root) {
|
|
35664
|
-
const absolute =
|
|
35739
|
+
const absolute = resolve9(root);
|
|
35665
35740
|
let realProfile;
|
|
35666
35741
|
if (process.platform === "win32") {
|
|
35667
|
-
const profile =
|
|
35742
|
+
const profile = resolve9(homedir4());
|
|
35668
35743
|
assertWindowsProfileBoundary(profile, absolute);
|
|
35669
35744
|
await rejectWindowsSymlinkAncestors(profile, absolute);
|
|
35670
35745
|
realProfile = await realpath7(profile);
|
|
@@ -35696,7 +35771,7 @@ async function sweepOrphanedRunArtifacts(root) {
|
|
|
35696
35771
|
return removed;
|
|
35697
35772
|
}
|
|
35698
35773
|
function defaultRunRegistryRoot() {
|
|
35699
|
-
return join13(
|
|
35774
|
+
return join13(homedir4(), ".zixt", "run-registry");
|
|
35700
35775
|
}
|
|
35701
35776
|
async function syncRunRegistryDirectory(path) {
|
|
35702
35777
|
const handle = await open5(path, "r");
|
|
@@ -35709,9 +35784,9 @@ async function syncRunRegistryDirectory(path) {
|
|
|
35709
35784
|
async function ensureDurableRunRegistryRoot(registryRoot, syncDirectory7) {
|
|
35710
35785
|
const firstCreated = await mkdir9(registryRoot, { recursive: true, mode: DIRECTORY_MODE4 });
|
|
35711
35786
|
if (firstCreated && process.platform !== "win32") {
|
|
35712
|
-
const first =
|
|
35713
|
-
const target =
|
|
35714
|
-
await syncDirectory7(
|
|
35787
|
+
const first = resolve9(firstCreated);
|
|
35788
|
+
const target = resolve9(registryRoot);
|
|
35789
|
+
await syncDirectory7(dirname7(first));
|
|
35715
35790
|
let current = first;
|
|
35716
35791
|
for (const part of relative8(first, target).split(sep4).filter(Boolean)) {
|
|
35717
35792
|
await syncDirectory7(current);
|
|
@@ -35886,7 +35961,7 @@ async function settlesWithin(promise2, timeoutMs) {
|
|
|
35886
35961
|
}
|
|
35887
35962
|
}
|
|
35888
35963
|
function defaultRunnerWorkspaceRoot() {
|
|
35889
|
-
return join14(
|
|
35964
|
+
return join14(homedir5(), ".zixt", "workspaces");
|
|
35890
35965
|
}
|
|
35891
35966
|
function defaultRunnerArtifactRoot() {
|
|
35892
35967
|
return defaultRunArtifactRoot();
|
|
@@ -35946,7 +36021,7 @@ function createCliRunner(adapter, opts = {}) {
|
|
|
35946
36021
|
const prefixArgs = opts.commandPrefixArgs ?? [];
|
|
35947
36022
|
const maxWallTimeMs = opts.maxWallTimeMs;
|
|
35948
36023
|
const workspaceRoot = opts.workspaceRoot ?? defaultRunnerWorkspaceRoot();
|
|
35949
|
-
const artifactRoot = opts.artifactRoot ?? (opts.workspaceRoot === void 0 ? defaultRunnerArtifactRoot() : join14(
|
|
36024
|
+
const artifactRoot = opts.artifactRoot ?? (opts.workspaceRoot === void 0 ? defaultRunnerArtifactRoot() : join14(dirname8(workspaceRoot), "run-artifacts"));
|
|
35950
36025
|
const runRegistryRoot2 = opts.runRegistryRoot ?? defaultRunRegistryRoot();
|
|
35951
36026
|
const createArtifacts = opts.createArtifacts ?? createRunArtifacts;
|
|
35952
36027
|
const toolPackRegistry2 = opts.toolPackRegistry ?? createDefaultToolPackRegistry();
|
|
@@ -36031,7 +36106,7 @@ function createCliRunner(adapter, opts = {}) {
|
|
|
36031
36106
|
outcome.ok && outcome.result && typeof outcome.result === "object" ? outcome.result["artifact"] : void 0
|
|
36032
36107
|
);
|
|
36033
36108
|
if (parsed.success) {
|
|
36034
|
-
const candidate =
|
|
36109
|
+
const candidate = resolve10(cwd, path);
|
|
36035
36110
|
const key = await realpath8(candidate).catch(() => candidate);
|
|
36036
36111
|
publishedTaskFiles.set(key, parsed.data);
|
|
36037
36112
|
}
|
|
@@ -36312,8 +36387,8 @@ ${attachmentSection}` : prompt;
|
|
|
36312
36387
|
let changed = false;
|
|
36313
36388
|
for (const path of paths) {
|
|
36314
36389
|
if (!path || path.length > 4096) continue;
|
|
36315
|
-
const absolutePath = isAbsolute14(path) ? path :
|
|
36316
|
-
const directory =
|
|
36390
|
+
const absolutePath = isAbsolute14(path) ? path : resolve10(cwd, path);
|
|
36391
|
+
const directory = dirname8(absolutePath);
|
|
36317
36392
|
observedWorkingDirectories.delete(directory);
|
|
36318
36393
|
observedWorkingDirectories.add(directory);
|
|
36319
36394
|
while (observedWorkingDirectories.size > 19) {
|
|
@@ -36745,7 +36820,7 @@ function runCliProcess(options) {
|
|
|
36745
36820
|
usage: { inputTokens: 0, outputTokens: 0 }
|
|
36746
36821
|
});
|
|
36747
36822
|
}
|
|
36748
|
-
return new Promise((
|
|
36823
|
+
return new Promise((resolve17) => {
|
|
36749
36824
|
const platform = options.platform ?? process.platform;
|
|
36750
36825
|
const containmentGateNonce = options.guardian && platform === "win32" ? randomUUID10() : void 0;
|
|
36751
36826
|
const child = options.guardian ? spawn8(
|
|
@@ -36759,7 +36834,7 @@ function runCliProcess(options) {
|
|
|
36759
36834
|
// The idle pre-assignment guardian must never load from or depend
|
|
36760
36835
|
// on an untrusted Task checkout. Only the post-gate target enters
|
|
36761
36836
|
// the requested working directory from its private release frame.
|
|
36762
|
-
cwd:
|
|
36837
|
+
cwd: dirname8(options.guardian.scriptPath),
|
|
36763
36838
|
env: runnerGuardianEnv(process.env, containmentGateNonce),
|
|
36764
36839
|
stdio: ["pipe", "pipe", "pipe"],
|
|
36765
36840
|
windowsHide: true,
|
|
@@ -36807,7 +36882,7 @@ function runCliProcess(options) {
|
|
|
36807
36882
|
clearInterval(timer);
|
|
36808
36883
|
unregisterFollowUps?.();
|
|
36809
36884
|
parser.stop?.();
|
|
36810
|
-
|
|
36885
|
+
resolve17(result);
|
|
36811
36886
|
};
|
|
36812
36887
|
const terminate = (result) => {
|
|
36813
36888
|
if (settled || forcedResult) return;
|
|
@@ -37040,13 +37115,13 @@ import { randomUUID as randomUUID11 } from "node:crypto";
|
|
|
37040
37115
|
|
|
37041
37116
|
// src/runners/runtime-observation.ts
|
|
37042
37117
|
import { open as open6, readdir as readdir4, realpath as realpath9 } from "node:fs/promises";
|
|
37043
|
-
import { homedir as
|
|
37118
|
+
import { homedir as homedir6 } from "node:os";
|
|
37044
37119
|
import { join as join15 } from "node:path";
|
|
37045
37120
|
var READ_WINDOW_BYTES = 1024 * 1024;
|
|
37046
37121
|
var CATALOG_TIMEOUT_MS = 15e3;
|
|
37047
37122
|
var CATALOG_OUTPUT_LIMIT_BYTES = 4 * 1024 * 1024;
|
|
37048
37123
|
function homeFrom(env) {
|
|
37049
|
-
return env["HOME"] || env["USERPROFILE"] ||
|
|
37124
|
+
return env["HOME"] || env["USERPROFILE"] || homedir6();
|
|
37050
37125
|
}
|
|
37051
37126
|
async function readHead(path) {
|
|
37052
37127
|
let handle;
|
|
@@ -37153,7 +37228,7 @@ async function readCodexSessionRuntime(input) {
|
|
|
37153
37228
|
}
|
|
37154
37229
|
var codexCatalogCache = /* @__PURE__ */ new Map();
|
|
37155
37230
|
async function loadCodexModelCatalog(command, prefixArgs, env) {
|
|
37156
|
-
const output = await new Promise((
|
|
37231
|
+
const output = await new Promise((resolve17) => {
|
|
37157
37232
|
const child = spawnCli(command, [...prefixArgs, "debug", "models"], {
|
|
37158
37233
|
stdio: ["ignore", "pipe", "ignore"],
|
|
37159
37234
|
windowsHide: true,
|
|
@@ -37168,7 +37243,7 @@ async function loadCodexModelCatalog(command, prefixArgs, env) {
|
|
|
37168
37243
|
if (settled) return;
|
|
37169
37244
|
settled = true;
|
|
37170
37245
|
clearTimeout(timer);
|
|
37171
|
-
|
|
37246
|
+
resolve17(value);
|
|
37172
37247
|
};
|
|
37173
37248
|
const timer = setTimeout(() => {
|
|
37174
37249
|
child.kill();
|
|
@@ -37273,8 +37348,8 @@ function createRuntimeReporter(input, sessionId) {
|
|
|
37273
37348
|
var EFFORT_READ_ATTEMPTS = 5;
|
|
37274
37349
|
var EFFORT_READ_INTERVAL_MS = 3e3;
|
|
37275
37350
|
function delay2(ms) {
|
|
37276
|
-
return new Promise((
|
|
37277
|
-
const timer = setTimeout(
|
|
37351
|
+
return new Promise((resolve17) => {
|
|
37352
|
+
const timer = setTimeout(resolve17, ms);
|
|
37278
37353
|
timer.unref?.();
|
|
37279
37354
|
});
|
|
37280
37355
|
}
|
|
@@ -37351,10 +37426,10 @@ function createClaudeLiveParser(onStream, onSessionModel) {
|
|
|
37351
37426
|
},
|
|
37352
37427
|
async steer(followUp) {
|
|
37353
37428
|
if (!write) return false;
|
|
37354
|
-
return await new Promise((
|
|
37355
|
-
acknowledgements.set(followUp.inputId,
|
|
37429
|
+
return await new Promise((resolve17) => {
|
|
37430
|
+
acknowledgements.set(followUp.inputId, resolve17);
|
|
37356
37431
|
void write(input(followUp.inputId, followUp.text)).catch(() => {
|
|
37357
|
-
if (acknowledgements.delete(followUp.inputId))
|
|
37432
|
+
if (acknowledgements.delete(followUp.inputId)) resolve17(false);
|
|
37358
37433
|
});
|
|
37359
37434
|
});
|
|
37360
37435
|
},
|
|
@@ -37516,11 +37591,11 @@ function improveErrorMessage(error52) {
|
|
|
37516
37591
|
// src/runners/codex.ts
|
|
37517
37592
|
import { mkdir as mkdir11, readFile as readFile9, writeFile as writeFile6 } from "node:fs/promises";
|
|
37518
37593
|
import { randomUUID as randomUUID12 } from "node:crypto";
|
|
37519
|
-
import { homedir as
|
|
37594
|
+
import { homedir as homedir7 } from "node:os";
|
|
37520
37595
|
import { join as join16 } from "node:path";
|
|
37521
37596
|
var CODEX_NOT_FOUND_MESSAGE = "The `codex` CLI was not found on this Machine. Install it (npm install -g @openai/codex) and sign in with `codex login`, or switch the agent to API-key auth.";
|
|
37522
37597
|
function defaultCodexThreadIndexRoot() {
|
|
37523
|
-
return join16(
|
|
37598
|
+
return join16(homedir7(), ".zixt", "codex-threads");
|
|
37524
37599
|
}
|
|
37525
37600
|
var SAFE_SEGMENT3 = /^[A-Za-z0-9_-]{1,200}$/;
|
|
37526
37601
|
function threadIndexPath(root, agentId, sessionKey) {
|
|
@@ -37661,8 +37736,8 @@ ${value}` : value;
|
|
|
37661
37736
|
var RUNTIME_READ_ATTEMPTS = 5;
|
|
37662
37737
|
var RUNTIME_READ_INTERVAL_MS = 2e3;
|
|
37663
37738
|
function delay3(ms) {
|
|
37664
|
-
return new Promise((
|
|
37665
|
-
const timer = setTimeout(
|
|
37739
|
+
return new Promise((resolve17) => {
|
|
37740
|
+
const timer = setTimeout(resolve17, ms);
|
|
37666
37741
|
timer.unref?.();
|
|
37667
37742
|
});
|
|
37668
37743
|
}
|
|
@@ -37701,7 +37776,7 @@ function createCodexAppServerParser(onStream, options) {
|
|
|
37701
37776
|
const turnReadyWaiters = /* @__PURE__ */ new Set();
|
|
37702
37777
|
const usage = () => ({ inputTokens, outputTokens });
|
|
37703
37778
|
const settleTurnReadiness = (ready) => {
|
|
37704
|
-
for (const
|
|
37779
|
+
for (const resolve17 of turnReadyWaiters) resolve17(ready);
|
|
37705
37780
|
turnReadyWaiters.clear();
|
|
37706
37781
|
};
|
|
37707
37782
|
const send = async (message) => {
|
|
@@ -37882,12 +37957,12 @@ function createCodexAppServerParser(onStream, options) {
|
|
|
37882
37957
|
async steer(input) {
|
|
37883
37958
|
if (stopped) return false;
|
|
37884
37959
|
if (!activeTurnId) {
|
|
37885
|
-
const ready = await new Promise((
|
|
37960
|
+
const ready = await new Promise((resolve17) => turnReadyWaiters.add(resolve17));
|
|
37886
37961
|
if (!ready || stopped) return false;
|
|
37887
37962
|
}
|
|
37888
37963
|
if (!threadId || !activeTurnId) return false;
|
|
37889
|
-
return await new Promise((
|
|
37890
|
-
steerWaiters.set(input.inputId,
|
|
37964
|
+
return await new Promise((resolve17) => {
|
|
37965
|
+
steerWaiters.set(input.inputId, resolve17);
|
|
37891
37966
|
void send({
|
|
37892
37967
|
id: `steer:${input.inputId}`,
|
|
37893
37968
|
method: "turn/steer",
|
|
@@ -37898,7 +37973,7 @@ function createCodexAppServerParser(onStream, options) {
|
|
|
37898
37973
|
clientUserMessageId: input.inputId
|
|
37899
37974
|
}
|
|
37900
37975
|
}).catch(() => {
|
|
37901
|
-
if (steerWaiters.delete(input.inputId))
|
|
37976
|
+
if (steerWaiters.delete(input.inputId)) resolve17(false);
|
|
37902
37977
|
});
|
|
37903
37978
|
});
|
|
37904
37979
|
},
|
|
@@ -37906,7 +37981,7 @@ function createCodexAppServerParser(onStream, options) {
|
|
|
37906
37981
|
stopped = true;
|
|
37907
37982
|
write = null;
|
|
37908
37983
|
settleTurnReadiness(false);
|
|
37909
|
-
for (const
|
|
37984
|
+
for (const resolve17 of steerWaiters.values()) resolve17(false);
|
|
37910
37985
|
steerWaiters.clear();
|
|
37911
37986
|
},
|
|
37912
37987
|
push(chunk) {
|
|
@@ -38085,7 +38160,7 @@ function improveCodexErrorMessage(error52) {
|
|
|
38085
38160
|
// src/runners/git-preflight.ts
|
|
38086
38161
|
import { spawn as spawn9 } from "node:child_process";
|
|
38087
38162
|
import { realpath as realpath10 } from "node:fs/promises";
|
|
38088
|
-
import { isAbsolute as isAbsolute15, resolve as
|
|
38163
|
+
import { isAbsolute as isAbsolute15, resolve as resolve11 } from "node:path";
|
|
38089
38164
|
var OUTPUT_LIMIT = 8192;
|
|
38090
38165
|
var DEFAULT_TIMEOUT_MS4 = 1e4;
|
|
38091
38166
|
var VERSION_PATTERN = /^git version [^\r\n]{1,108}$/;
|
|
@@ -38104,7 +38179,7 @@ async function preflightGit(options = {}) {
|
|
|
38104
38179
|
if (configured !== void 0 && !isAbsolute15(configured)) {
|
|
38105
38180
|
return unavailable("configured git command must be an absolute file", checkedAt);
|
|
38106
38181
|
}
|
|
38107
|
-
const trustedCwd = await realpath10(
|
|
38182
|
+
const trustedCwd = await realpath10(resolve11(options.trustedCwd ?? process.cwd())).catch(() => null);
|
|
38108
38183
|
if (!trustedCwd)
|
|
38109
38184
|
return unavailable("Host-owned git preflight directory is unavailable", checkedAt);
|
|
38110
38185
|
const executablePath = await resolveTrustedCliCommand(configured ?? "git", {
|
|
@@ -38326,7 +38401,7 @@ function parseAuth(result) {
|
|
|
38326
38401
|
return "unknown";
|
|
38327
38402
|
}
|
|
38328
38403
|
function run2(command, args) {
|
|
38329
|
-
return new Promise((
|
|
38404
|
+
return new Promise((resolve17) => {
|
|
38330
38405
|
const child = spawnCli(command, args, {
|
|
38331
38406
|
stdio: ["ignore", "pipe", "pipe"],
|
|
38332
38407
|
windowsHide: true
|
|
@@ -38342,7 +38417,7 @@ function run2(command, args) {
|
|
|
38342
38417
|
if (settled) return;
|
|
38343
38418
|
settled = true;
|
|
38344
38419
|
clearTimeout(timeout);
|
|
38345
|
-
|
|
38420
|
+
resolve17(result);
|
|
38346
38421
|
};
|
|
38347
38422
|
const timeout = setTimeout(() => {
|
|
38348
38423
|
child.kill();
|
|
@@ -38357,8 +38432,8 @@ function run2(command, args) {
|
|
|
38357
38432
|
import { spawn as spawn10 } from "node:child_process";
|
|
38358
38433
|
import { constants as constants2 } from "node:fs";
|
|
38359
38434
|
import { access as access4, chmod as chmod7, mkdir as mkdir12, open as open7, rename as rename6, rm as rm8 } from "node:fs/promises";
|
|
38360
|
-
import { homedir as
|
|
38361
|
-
import { basename as basename4, dirname as
|
|
38435
|
+
import { homedir as homedir8, userInfo } from "node:os";
|
|
38436
|
+
import { basename as basename4, dirname as dirname9, join as join17, relative as relative9, resolve as resolve12, sep as sep5 } from "node:path";
|
|
38362
38437
|
var SERVICE_NAME = "zixt-host.service";
|
|
38363
38438
|
var SYSTEM_SERVICE_COMMAND_TIMEOUT_MS = 7e4;
|
|
38364
38439
|
var SERVICE_STABILITY_DELAY_MS = 2e3;
|
|
@@ -38386,7 +38461,7 @@ function boundedAppend(current, chunk) {
|
|
|
38386
38461
|
}
|
|
38387
38462
|
async function defaultRunCommand(command, args) {
|
|
38388
38463
|
const commandEnvironment3 = systemServiceCommandEnvironment();
|
|
38389
|
-
return new Promise((
|
|
38464
|
+
return new Promise((resolve17) => {
|
|
38390
38465
|
const child = spawn10(command, [...args], {
|
|
38391
38466
|
stdio: ["ignore", "pipe", "pipe"],
|
|
38392
38467
|
env: commandEnvironment3,
|
|
@@ -38400,7 +38475,7 @@ async function defaultRunCommand(command, args) {
|
|
|
38400
38475
|
if (settled) return;
|
|
38401
38476
|
settled = true;
|
|
38402
38477
|
if (timer) clearTimeout(timer);
|
|
38403
|
-
|
|
38478
|
+
resolve17(result);
|
|
38404
38479
|
};
|
|
38405
38480
|
child.stdout?.on("data", (chunk) => {
|
|
38406
38481
|
stdout = boundedAppend(stdout, chunk);
|
|
@@ -38461,9 +38536,9 @@ async function defaultSyncDirectory(path) {
|
|
|
38461
38536
|
async function ensureDirectory(path, mode, syncDirectory7) {
|
|
38462
38537
|
const firstCreated = await mkdir12(path, { recursive: true, mode });
|
|
38463
38538
|
if (!firstCreated) return;
|
|
38464
|
-
const first =
|
|
38465
|
-
const target =
|
|
38466
|
-
await syncDirectory7(
|
|
38539
|
+
const first = resolve12(firstCreated);
|
|
38540
|
+
const target = resolve12(path);
|
|
38541
|
+
await syncDirectory7(dirname9(first));
|
|
38467
38542
|
let current = first;
|
|
38468
38543
|
const descendants = relative9(first, target);
|
|
38469
38544
|
for (const part of descendants ? descendants.split(sep5) : []) {
|
|
@@ -38472,7 +38547,7 @@ async function ensureDirectory(path, mode, syncDirectory7) {
|
|
|
38472
38547
|
}
|
|
38473
38548
|
}
|
|
38474
38549
|
async function replacePrivateFile(path, contents, mode, syncDirectory7) {
|
|
38475
|
-
const parent =
|
|
38550
|
+
const parent = dirname9(path);
|
|
38476
38551
|
await ensureDirectory(parent, 448, syncDirectory7);
|
|
38477
38552
|
const temporary = join17(parent, `.${basename4(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
|
|
38478
38553
|
const handle = await open7(temporary, "wx", mode);
|
|
@@ -38518,7 +38593,7 @@ async function installLinuxService(options) {
|
|
|
38518
38593
|
throw new Error("Linux automatic startup is available only on Linux.");
|
|
38519
38594
|
}
|
|
38520
38595
|
const env = options.env ?? process.env;
|
|
38521
|
-
const home = options.home ??
|
|
38596
|
+
const home = options.home ?? homedir8();
|
|
38522
38597
|
const username = oneLine(options.username ?? userInfo().username, "user name");
|
|
38523
38598
|
const token2 = oneLine(options.token, "pairing code");
|
|
38524
38599
|
const path = oneLine(
|
|
@@ -38536,7 +38611,7 @@ async function installLinuxService(options) {
|
|
|
38536
38611
|
const resolveCommand = options.resolveCommand ?? defaultResolveCommand;
|
|
38537
38612
|
const run3 = options.runCommand ?? defaultRunCommand;
|
|
38538
38613
|
const syncDirectory7 = options.syncDirectory ?? defaultSyncDirectory;
|
|
38539
|
-
const stabilityDelay = options.delay ?? ((ms) => new Promise((
|
|
38614
|
+
const stabilityDelay = options.delay ?? ((ms) => new Promise((resolve17) => setTimeout(resolve17, ms)));
|
|
38540
38615
|
const [systemctl, loginctl] = await Promise.all([
|
|
38541
38616
|
resolveCommand("systemctl"),
|
|
38542
38617
|
resolveCommand("loginctl")
|
|
@@ -38650,8 +38725,8 @@ async function installLinuxService(options) {
|
|
|
38650
38725
|
import { spawn as spawn11 } from "node:child_process";
|
|
38651
38726
|
import { constants as constants3 } from "node:fs";
|
|
38652
38727
|
import { access as access5, chmod as chmod8, mkdir as mkdir13, open as open8, rename as rename7, rm as rm9 } from "node:fs/promises";
|
|
38653
|
-
import { homedir as
|
|
38654
|
-
import { basename as basename5, dirname as
|
|
38728
|
+
import { homedir as homedir9, userInfo as userInfo2 } from "node:os";
|
|
38729
|
+
import { basename as basename5, dirname as dirname10, join as join18, relative as relative10, resolve as resolve13, sep as sep6 } from "node:path";
|
|
38655
38730
|
var LAUNCH_AGENT_LABEL = "ai.zixt.host";
|
|
38656
38731
|
var SERVICE_STABILITY_DELAY_MS2 = 2e3;
|
|
38657
38732
|
var COMMAND_TIMEOUT_MS2 = 7e4;
|
|
@@ -38677,9 +38752,9 @@ async function syncDirectory4(path) {
|
|
|
38677
38752
|
async function ensureDirectory2(path, sync) {
|
|
38678
38753
|
const firstCreated = await mkdir13(path, { recursive: true, mode: 448 });
|
|
38679
38754
|
if (!firstCreated) return;
|
|
38680
|
-
const first =
|
|
38681
|
-
const target =
|
|
38682
|
-
await sync(
|
|
38755
|
+
const first = resolve13(firstCreated);
|
|
38756
|
+
const target = resolve13(path);
|
|
38757
|
+
await sync(dirname10(first));
|
|
38683
38758
|
let current = first;
|
|
38684
38759
|
for (const part of relative10(first, target).split(sep6).filter(Boolean)) {
|
|
38685
38760
|
await sync(current);
|
|
@@ -38687,7 +38762,7 @@ async function ensureDirectory2(path, sync) {
|
|
|
38687
38762
|
}
|
|
38688
38763
|
}
|
|
38689
38764
|
async function replacePrivateFile2(path, contents, mode, sync) {
|
|
38690
|
-
const parent =
|
|
38765
|
+
const parent = dirname10(path);
|
|
38691
38766
|
await ensureDirectory2(parent, sync);
|
|
38692
38767
|
const temporary = join18(parent, `.${basename5(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
|
|
38693
38768
|
const handle = await open8(temporary, "wx", mode);
|
|
@@ -38777,7 +38852,7 @@ async function installMacosService(options) {
|
|
|
38777
38852
|
throw new Error("macOS automatic startup is available only on macOS.");
|
|
38778
38853
|
}
|
|
38779
38854
|
const env = options.env ?? process.env;
|
|
38780
|
-
const home = options.home ??
|
|
38855
|
+
const home = options.home ?? homedir9();
|
|
38781
38856
|
const uid = options.uid ?? userInfo2().uid;
|
|
38782
38857
|
if (!Number.isSafeInteger(uid) || uid < 0) throw new Error("macOS user id is invalid.");
|
|
38783
38858
|
const token2 = oneLine2(options.token, "pairing code");
|
|
@@ -38881,8 +38956,8 @@ async function installMacosService(options) {
|
|
|
38881
38956
|
import { spawn as spawn12 } from "node:child_process";
|
|
38882
38957
|
import { constants as constants4 } from "node:fs";
|
|
38883
38958
|
import { access as access6, mkdir as mkdir14, open as open9, readFile as readFile10, rename as rename8, rm as rm10 } from "node:fs/promises";
|
|
38884
|
-
import { homedir as
|
|
38885
|
-
import { basename as basename6, dirname as
|
|
38959
|
+
import { homedir as homedir10 } from "node:os";
|
|
38960
|
+
import { basename as basename6, dirname as dirname11, isAbsolute as isAbsolute16, join as join19, relative as relative11, resolve as resolve14, sep as sep7 } from "node:path";
|
|
38886
38961
|
var TASK_NAME = "Zixt Host";
|
|
38887
38962
|
var COMMAND_TIMEOUT_MS3 = 7e4;
|
|
38888
38963
|
var SERVICE_STABILITY_DELAY_MS3 = 2e3;
|
|
@@ -38910,9 +38985,9 @@ async function syncDirectory5(path) {
|
|
|
38910
38985
|
async function ensureDirectory3(path, sync) {
|
|
38911
38986
|
const firstCreated = await mkdir14(path, { recursive: true, mode: 448 });
|
|
38912
38987
|
if (!firstCreated) return;
|
|
38913
|
-
const first =
|
|
38914
|
-
const target =
|
|
38915
|
-
await sync(
|
|
38988
|
+
const first = resolve14(firstCreated);
|
|
38989
|
+
const target = resolve14(path);
|
|
38990
|
+
await sync(dirname11(first));
|
|
38916
38991
|
let current = first;
|
|
38917
38992
|
for (const part of relative11(first, target).split(sep7).filter(Boolean)) {
|
|
38918
38993
|
await sync(current);
|
|
@@ -38920,7 +38995,7 @@ async function ensureDirectory3(path, sync) {
|
|
|
38920
38995
|
}
|
|
38921
38996
|
}
|
|
38922
38997
|
async function replacePrivateFile3(path, contents, sync) {
|
|
38923
|
-
const parent =
|
|
38998
|
+
const parent = dirname11(path);
|
|
38924
38999
|
await ensureDirectory3(parent, sync);
|
|
38925
39000
|
const temporary = join19(parent, `.${basename6(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
|
|
38926
39001
|
const handle = await open9(temporary, "wx", 384);
|
|
@@ -39106,7 +39181,7 @@ async function installWindowsService(options) {
|
|
|
39106
39181
|
throw new Error("Windows automatic startup is available only on Windows.");
|
|
39107
39182
|
}
|
|
39108
39183
|
const env = options.env ?? process.env;
|
|
39109
|
-
const home = options.home ??
|
|
39184
|
+
const home = options.home ?? homedir10();
|
|
39110
39185
|
const localAppData = options.localAppData ?? env.LOCALAPPDATA;
|
|
39111
39186
|
if (!localAppData || !isAbsolute16(localAppData)) {
|
|
39112
39187
|
throw new Error("Windows local application data path is unavailable.");
|
|
@@ -39220,15 +39295,15 @@ async function installSystemService(options) {
|
|
|
39220
39295
|
|
|
39221
39296
|
// src/terminal-outcomes.ts
|
|
39222
39297
|
import { chmod as chmod9, lstat as lstat12, mkdir as mkdir15, open as open10, readdir as readdir5, readFile as readFile11, rename as rename9, rm as rm11 } from "node:fs/promises";
|
|
39223
|
-
import { homedir as
|
|
39224
|
-
import { dirname as
|
|
39298
|
+
import { homedir as homedir11 } from "node:os";
|
|
39299
|
+
import { dirname as dirname12, join as join20, relative as relative12, resolve as resolve15, sep as sep8 } from "node:path";
|
|
39225
39300
|
var DIRECTORY_MODE5 = 448;
|
|
39226
39301
|
var FILE_MODE4 = 384;
|
|
39227
39302
|
var MAX_OUTCOME_BYTES = 4 * 1024 * 1024;
|
|
39228
39303
|
var HOST_DIRECTORY = /^hst_[0-9a-f]{32}$/;
|
|
39229
39304
|
var OUTCOME_FILE = /^(tsk_[0-9a-f]{32})\.([1-9][0-9]*)\.json$/;
|
|
39230
39305
|
function defaultTerminalOutcomeRoot() {
|
|
39231
|
-
return join20(
|
|
39306
|
+
return join20(homedir11(), ".zixt", "terminal-outcomes");
|
|
39232
39307
|
}
|
|
39233
39308
|
function hostOutcomeRoot(root, hostId) {
|
|
39234
39309
|
if (!HOST_DIRECTORY.test(hostId)) throw new Error("terminal outcome Host identity is malformed");
|
|
@@ -39249,9 +39324,9 @@ async function syncDirectory6(root) {
|
|
|
39249
39324
|
async function requirePrivateRoot(root, sync = syncDirectory6) {
|
|
39250
39325
|
const firstCreated = await mkdir15(root, { recursive: true, mode: DIRECTORY_MODE5 });
|
|
39251
39326
|
if (firstCreated) {
|
|
39252
|
-
const first =
|
|
39253
|
-
const target =
|
|
39254
|
-
await sync(
|
|
39327
|
+
const first = resolve15(firstCreated);
|
|
39328
|
+
const target = resolve15(root);
|
|
39329
|
+
await sync(dirname12(first));
|
|
39255
39330
|
let current = first;
|
|
39256
39331
|
for (const part of relative12(first, target).split(sep8).filter(Boolean)) {
|
|
39257
39332
|
await sync(current);
|
|
@@ -39501,12 +39576,12 @@ function createHostLogger(options = {}) {
|
|
|
39501
39576
|
}
|
|
39502
39577
|
|
|
39503
39578
|
// src/demo-state.ts
|
|
39504
|
-
import { isAbsolute as isAbsolute17, join as join21, parse as parse3, resolve as
|
|
39579
|
+
import { isAbsolute as isAbsolute17, join as join21, parse as parse3, resolve as resolve16 } from "node:path";
|
|
39505
39580
|
var DEMO_STATE_ROOT_ENV = "ZIXT_DEMO_STATE_ROOT";
|
|
39506
39581
|
function resolveDemoHostStatePaths(env = process.env) {
|
|
39507
39582
|
const configured = env.ZIXT_RUNNER === "demo" ? env[DEMO_STATE_ROOT_ENV] : void 0;
|
|
39508
39583
|
if (!configured) return null;
|
|
39509
|
-
const root =
|
|
39584
|
+
const root = resolve16(configured);
|
|
39510
39585
|
if (!isAbsolute17(configured) || root === parse3(root).root) {
|
|
39511
39586
|
throw new Error(`${DEMO_STATE_ROOT_ENV} must be a dedicated absolute directory`);
|
|
39512
39587
|
}
|
|
@@ -39924,6 +39999,10 @@ async function telemetry() {
|
|
|
39924
39999
|
runners: cachedRunners ?? [],
|
|
39925
40000
|
workspaces: [],
|
|
39926
40001
|
docker: "unknown",
|
|
40002
|
+
// Measured per heartbeat: free memory and free disk are only useful while
|
|
40003
|
+
// they are current, and a demo Host reports its own private root so the
|
|
40004
|
+
// number describes the filesystem its Tasks would really write to.
|
|
40005
|
+
hardware: await machineHardware(runnerWorkspaceRoot ?? homedir12()),
|
|
39927
40006
|
capabilities: {
|
|
39928
40007
|
linearToolPack: providerToolPacks.some(
|
|
39929
40008
|
(pack) => pack.provider === "linear" && pack.health === "ready"
|