@zixt/host 0.0.69 → 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 +445 -368
- 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
|
/**
|
|
@@ -18473,6 +18492,186 @@ var ManagerStreamFrame = external_exports.discriminatedUnion("type", [
|
|
|
18473
18492
|
external_exports.object({ type: external_exports.literal("conversation"), conversation: ConversationProjection }).strict()
|
|
18474
18493
|
]);
|
|
18475
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
|
+
|
|
18476
18675
|
// ../../packages/contracts/src/api.ts
|
|
18477
18676
|
var ProblemCode = external_exports.enum([
|
|
18478
18677
|
"network_unavailable",
|
|
@@ -18520,6 +18719,11 @@ var CreateOrgRequest = external_exports.object({
|
|
|
18520
18719
|
name: Org.shape.name,
|
|
18521
18720
|
slug: Org.shape.slug
|
|
18522
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
|
+
});
|
|
18523
18727
|
var DESKTOP_SIDEBAR_MIN_WIDTH_PX = 240;
|
|
18524
18728
|
var DESKTOP_SIDEBAR_MAX_WIDTH_PX = 420;
|
|
18525
18729
|
var TASK_SIDEBAR_MIN_WIDTH_PX = 240;
|
|
@@ -18821,6 +19025,15 @@ var HostConsoleResponse = external_exports.object({
|
|
|
18821
19025
|
available: external_exports.boolean()
|
|
18822
19026
|
});
|
|
18823
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
|
+
});
|
|
18824
19037
|
|
|
18825
19038
|
// ../../packages/contracts/src/redaction.ts
|
|
18826
19039
|
var REDACTED_CREDENTIAL = "[REDACTED]";
|
|
@@ -19918,186 +20131,6 @@ var BrowserOAuthConfig = external_exports.object({
|
|
|
19918
20131
|
githubAppSlug: GithubAppSlug.nullable()
|
|
19919
20132
|
}).strict();
|
|
19920
20133
|
|
|
19921
|
-
// ../../packages/contracts/src/platform.ts
|
|
19922
|
-
var JournalEntry = external_exports.object({
|
|
19923
|
-
id: external_exports.string(),
|
|
19924
|
-
agentId: AgentId,
|
|
19925
|
-
/** auto = task/comm lifecycle; note = agent-written. */
|
|
19926
|
-
kind: external_exports.enum(["auto", "note"]),
|
|
19927
|
-
text: external_exports.string().min(1).max(1e4),
|
|
19928
|
-
at: IsoDate2
|
|
19929
|
-
});
|
|
19930
|
-
var MemoryEntry = external_exports.object({
|
|
19931
|
-
id: external_exports.string(),
|
|
19932
|
-
agentId: AgentId,
|
|
19933
|
-
/** Machine display name; null = true everywhere (global). */
|
|
19934
|
-
machine: external_exports.string().nullable(),
|
|
19935
|
-
kind: external_exports.enum(["fact", "preference", "lesson", "context", "correction", "project", "environment"]),
|
|
19936
|
-
/** TS-10: written during an external-origin run; render as untrusted data. */
|
|
19937
|
-
trust: external_exports.enum(["internal", "external"]),
|
|
19938
|
-
text: external_exports.string().min(1).max(2e3),
|
|
19939
|
-
updatedAt: IsoDate2
|
|
19940
|
-
});
|
|
19941
|
-
var JournalResponse = external_exports.object({
|
|
19942
|
-
/** Bounded current-state summary (compaction target). */
|
|
19943
|
-
summary: external_exports.string(),
|
|
19944
|
-
entries: external_exports.array(JournalEntry),
|
|
19945
|
-
/** Curated memory, newest first. Absent only from pre-memory clients' view. */
|
|
19946
|
-
memories: external_exports.array(MemoryEntry).default([])
|
|
19947
|
-
});
|
|
19948
|
-
var AuditRecord = external_exports.object({
|
|
19949
|
-
id: external_exports.string(),
|
|
19950
|
-
/** member:<id>, agent:<id>, host:<id>, or system. */
|
|
19951
|
-
actor: external_exports.string(),
|
|
19952
|
-
action: external_exports.string(),
|
|
19953
|
-
/** Prefixed id of the acted-on resource. */
|
|
19954
|
-
target: external_exports.string(),
|
|
19955
|
-
summary: external_exports.string().max(2e3),
|
|
19956
|
-
/** Exact machine-readable deltas when the event changes configuration. */
|
|
19957
|
-
changes: external_exports.object({
|
|
19958
|
-
connectionAccess: external_exports.object({ before: ConnectionAccess, after: ConnectionAccess }).optional(),
|
|
19959
|
-
requiredConnectionIds: external_exports.object({
|
|
19960
|
-
before: external_exports.array(ConnectionId).max(100),
|
|
19961
|
-
after: external_exports.array(ConnectionId).max(100)
|
|
19962
|
-
}).optional(),
|
|
19963
|
-
integrationSettings: external_exports.object({ before: IntegrationSettings, after: IntegrationSettings }).optional()
|
|
19964
|
-
}).strict().optional(),
|
|
19965
|
-
at: IsoDate2
|
|
19966
|
-
});
|
|
19967
|
-
var ListAuditResponse = external_exports.object({ records: external_exports.array(AuditRecord) });
|
|
19968
|
-
var SecretScope = external_exports.enum(["org", "agent"]);
|
|
19969
|
-
var SecretKind = external_exports.enum(["env", "web_login"]);
|
|
19970
|
-
var SecretMeta = external_exports.object({
|
|
19971
|
-
name: external_exports.string().min(1).max(120).regex(/^[A-Z][A-Z0-9_]*$/, "UPPER_SNAKE_CASE env var name"),
|
|
19972
|
-
/** Absent on legacy rows/clients means `env`. */
|
|
19973
|
-
kind: SecretKind.default("env"),
|
|
19974
|
-
scope: SecretScope,
|
|
19975
|
-
/** Canonical availability set for teammate-scoped credentials. */
|
|
19976
|
-
agentIds: external_exports.array(AgentId).min(1).nullable().default(null),
|
|
19977
|
-
/** Legacy single-teammate projection, retained while older clients migrate. */
|
|
19978
|
-
agentId: AgentId.nullable(),
|
|
19979
|
-
/**
|
|
19980
|
-
* What this credential is for — rendered into the agent's system prompt
|
|
19981
|
-
* (names and descriptions only, never values) so the agent knows what it
|
|
19982
|
-
* holds and when to reach for it.
|
|
19983
|
-
*/
|
|
19984
|
-
description: external_exports.string().max(500).optional(),
|
|
19985
|
-
/** web_login metadata (admin projection only; never the password). */
|
|
19986
|
-
webLogin: external_exports.object({ loginUrl: external_exports.url().max(2e3), username: external_exports.string().min(1).max(500) }).strict().optional(),
|
|
19987
|
-
updatedAt: IsoDate2
|
|
19988
|
-
});
|
|
19989
|
-
var PutSecretFields = {
|
|
19990
|
-
name: SecretMeta.shape.name,
|
|
19991
|
-
kind: SecretKind.default("env"),
|
|
19992
|
-
/** env kind: required single value. */
|
|
19993
|
-
value: external_exports.string().min(1).max(1e4).optional(),
|
|
19994
|
-
/** web_login kind: required structured value. */
|
|
19995
|
-
webLogin: WebLoginValue.optional(),
|
|
19996
|
-
description: external_exports.string().max(500).optional()
|
|
19997
|
-
};
|
|
19998
|
-
var requireKindMatchingValue = (request, ctx) => {
|
|
19999
|
-
if (request.kind === "env") {
|
|
20000
|
-
if (request.value === void 0)
|
|
20001
|
-
ctx.addIssue({ code: "custom", path: ["value"], message: "env credentials require a value" });
|
|
20002
|
-
if (request.webLogin !== void 0)
|
|
20003
|
-
ctx.addIssue({
|
|
20004
|
-
code: "custom",
|
|
20005
|
-
path: ["webLogin"],
|
|
20006
|
-
message: "env credentials must not carry a website login"
|
|
20007
|
-
});
|
|
20008
|
-
} else {
|
|
20009
|
-
if (request.webLogin === void 0)
|
|
20010
|
-
ctx.addIssue({
|
|
20011
|
-
code: "custom",
|
|
20012
|
-
path: ["webLogin"],
|
|
20013
|
-
message: "website logins require loginUrl, username, and password"
|
|
20014
|
-
});
|
|
20015
|
-
if (request.value !== void 0)
|
|
20016
|
-
ctx.addIssue({
|
|
20017
|
-
code: "custom",
|
|
20018
|
-
path: ["value"],
|
|
20019
|
-
message: "website logins must not carry a bare value"
|
|
20020
|
-
});
|
|
20021
|
-
}
|
|
20022
|
-
};
|
|
20023
|
-
var PutSecretRequest = external_exports.discriminatedUnion("scope", [
|
|
20024
|
-
external_exports.object({ ...PutSecretFields, scope: external_exports.literal("org") }).strict().superRefine(requireKindMatchingValue),
|
|
20025
|
-
external_exports.object({
|
|
20026
|
-
...PutSecretFields,
|
|
20027
|
-
scope: external_exports.literal("agent"),
|
|
20028
|
-
agentIds: external_exports.array(AgentId).min(1).max(100).optional(),
|
|
20029
|
-
agentId: AgentId.optional()
|
|
20030
|
-
}).strict().superRefine((request, ctx) => {
|
|
20031
|
-
if (request.agentIds === void 0 === (request.agentId === void 0)) {
|
|
20032
|
-
ctx.addIssue({
|
|
20033
|
-
code: "custom",
|
|
20034
|
-
path: ["agentIds"],
|
|
20035
|
-
message: "teammate credentials require exactly one of agentIds or legacy agentId"
|
|
20036
|
-
});
|
|
20037
|
-
}
|
|
20038
|
-
if (request.agentIds && new Set(request.agentIds).size !== request.agentIds.length) {
|
|
20039
|
-
ctx.addIssue({ code: "custom", path: ["agentIds"], message: "duplicate AI teammate" });
|
|
20040
|
-
}
|
|
20041
|
-
}).superRefine(requireKindMatchingValue)
|
|
20042
|
-
]);
|
|
20043
|
-
var AdminSecretsProjection = external_exports.object({
|
|
20044
|
-
metadataRedacted: external_exports.literal(false),
|
|
20045
|
-
secrets: external_exports.array(SecretMeta)
|
|
20046
|
-
}).strict();
|
|
20047
|
-
var MemberSecretsProjection = external_exports.object({
|
|
20048
|
-
metadataRedacted: external_exports.literal(true),
|
|
20049
|
-
configured: external_exports.boolean(),
|
|
20050
|
-
secrets: external_exports.tuple([])
|
|
20051
|
-
}).strict();
|
|
20052
|
-
var ListSecretsResponse = external_exports.discriminatedUnion("metadataRedacted", [
|
|
20053
|
-
AdminSecretsProjection,
|
|
20054
|
-
MemberSecretsProjection
|
|
20055
|
-
]);
|
|
20056
|
-
var Invite = external_exports.object({
|
|
20057
|
-
id: external_exports.string(),
|
|
20058
|
-
orgId: OrgId,
|
|
20059
|
-
email: external_exports.email(),
|
|
20060
|
-
role: OrgRole.exclude(["owner"]),
|
|
20061
|
-
acceptedAt: IsoDate2.nullable(),
|
|
20062
|
-
expiresAt: IsoDate2,
|
|
20063
|
-
revokedAt: IsoDate2.nullable(),
|
|
20064
|
-
createdAt: IsoDate2
|
|
20065
|
-
});
|
|
20066
|
-
var CreateInviteRequest = external_exports.object({
|
|
20067
|
-
email: external_exports.email(),
|
|
20068
|
-
role: OrgRole.exclude(["owner"]).default("member")
|
|
20069
|
-
});
|
|
20070
|
-
var CreateInviteResponse = external_exports.object({
|
|
20071
|
-
invite: Invite,
|
|
20072
|
-
/** One-time acceptance URL, also emailed when the deployment has SMTP. */
|
|
20073
|
-
acceptUrl: external_exports.url(),
|
|
20074
|
-
/** True when the invitation email was accepted by the mail server. */
|
|
20075
|
-
emailed: external_exports.boolean().default(false)
|
|
20076
|
-
});
|
|
20077
|
-
var ListInvitesResponse = external_exports.object({ invites: external_exports.array(Invite) });
|
|
20078
|
-
var UpdateMemberRoleRequest = external_exports.object({ role: OrgRole });
|
|
20079
|
-
var ConnectorKind = external_exports.enum([
|
|
20080
|
-
"github",
|
|
20081
|
-
"slack",
|
|
20082
|
-
"linear",
|
|
20083
|
-
"zendesk",
|
|
20084
|
-
"jira",
|
|
20085
|
-
"email",
|
|
20086
|
-
"mcp"
|
|
20087
|
-
]);
|
|
20088
|
-
var ConnectorCatalogEntry = external_exports.object({
|
|
20089
|
-
kind: ConnectorKind,
|
|
20090
|
-
name: external_exports.string(),
|
|
20091
|
-
description: external_exports.string(),
|
|
20092
|
-
status: external_exports.enum(["available", "coming_soon"])
|
|
20093
|
-
});
|
|
20094
|
-
var ConnectionsCatalogResponse = external_exports.object({
|
|
20095
|
-
catalog: external_exports.array(ConnectorCatalogEntry),
|
|
20096
|
-
connections: external_exports.array(
|
|
20097
|
-
external_exports.object({ id: MemberId.or(external_exports.string()), kind: ConnectorKind, name: external_exports.string() })
|
|
20098
|
-
)
|
|
20099
|
-
});
|
|
20100
|
-
|
|
20101
20134
|
// ../../packages/contracts/src/secrets-env.ts
|
|
20102
20135
|
var BLOCKED_SECRET_ENV = /* @__PURE__ */ new Set([
|
|
20103
20136
|
"NODE_OPTIONS",
|
|
@@ -20501,7 +20534,7 @@ async function generateTaskTitle(instructions, runner) {
|
|
|
20501
20534
|
instructions.slice(0, INSTRUCTIONS_BUDGET),
|
|
20502
20535
|
"</task_request>"
|
|
20503
20536
|
].join("\n");
|
|
20504
|
-
return new Promise((
|
|
20537
|
+
return new Promise((resolve17) => {
|
|
20505
20538
|
const child = spawnCli(
|
|
20506
20539
|
command,
|
|
20507
20540
|
[
|
|
@@ -20524,7 +20557,7 @@ async function generateTaskTitle(instructions, runner) {
|
|
|
20524
20557
|
if (settled) return;
|
|
20525
20558
|
settled = true;
|
|
20526
20559
|
clearTimeout(timer);
|
|
20527
|
-
|
|
20560
|
+
resolve17(value);
|
|
20528
20561
|
};
|
|
20529
20562
|
const timer = setTimeout(() => {
|
|
20530
20563
|
child.kill();
|
|
@@ -20846,11 +20879,11 @@ function createWorkerWatchdogSendDrain() {
|
|
|
20846
20879
|
if (completed) return;
|
|
20847
20880
|
completed = true;
|
|
20848
20881
|
pending--;
|
|
20849
|
-
if (pending === 0) drained.splice(0).forEach((
|
|
20882
|
+
if (pending === 0) drained.splice(0).forEach((resolve17) => resolve17());
|
|
20850
20883
|
};
|
|
20851
20884
|
},
|
|
20852
20885
|
drain: async () => {
|
|
20853
|
-
if (pending > 0) await new Promise((
|
|
20886
|
+
if (pending > 0) await new Promise((resolve17) => drained.push(resolve17));
|
|
20854
20887
|
}
|
|
20855
20888
|
};
|
|
20856
20889
|
}
|
|
@@ -21095,7 +21128,7 @@ async function waitForOperationGrantRetry(retryAt, signal) {
|
|
|
21095
21128
|
const deadline = Date.parse(retryAt);
|
|
21096
21129
|
if (!Number.isFinite(deadline) || signal.aborted) return false;
|
|
21097
21130
|
if (deadline <= Date.now()) return true;
|
|
21098
|
-
return await new Promise((
|
|
21131
|
+
return await new Promise((resolve17) => {
|
|
21099
21132
|
let settled = false;
|
|
21100
21133
|
let timer;
|
|
21101
21134
|
const finish = (ready) => {
|
|
@@ -21103,7 +21136,7 @@ async function waitForOperationGrantRetry(retryAt, signal) {
|
|
|
21103
21136
|
settled = true;
|
|
21104
21137
|
if (timer) clearTimeout(timer);
|
|
21105
21138
|
signal.removeEventListener("abort", onAbort);
|
|
21106
|
-
|
|
21139
|
+
resolve17(ready);
|
|
21107
21140
|
};
|
|
21108
21141
|
const onAbort = () => finish(false);
|
|
21109
21142
|
const schedule = () => {
|
|
@@ -21371,22 +21404,22 @@ var HostClient = class _HostClient {
|
|
|
21371
21404
|
const unwindingAssignments = [...this.activeAssignments.values()];
|
|
21372
21405
|
for (const cancel of this.cancels.values()) cancel(stopReason);
|
|
21373
21406
|
for (const entry of this.secretGrants.values()) {
|
|
21374
|
-
for (const
|
|
21407
|
+
for (const resolve17 of entry.resolvers) resolve17({});
|
|
21375
21408
|
entry.resolvers = [];
|
|
21376
21409
|
delete entry.value;
|
|
21377
21410
|
}
|
|
21378
21411
|
for (const entry of this.connectionGrants.values()) {
|
|
21379
|
-
for (const
|
|
21412
|
+
for (const resolve17 of entry.resolvers) resolve17([]);
|
|
21380
21413
|
entry.resolvers = [];
|
|
21381
21414
|
delete entry.value;
|
|
21382
21415
|
}
|
|
21383
21416
|
for (const entry of this.providerGrants.values()) {
|
|
21384
|
-
for (const
|
|
21417
|
+
for (const resolve17 of entry.resolvers) resolve17([]);
|
|
21385
21418
|
entry.resolvers = [];
|
|
21386
21419
|
delete entry.value;
|
|
21387
21420
|
}
|
|
21388
21421
|
for (const waiters of this.approvalWaiters.values()) {
|
|
21389
|
-
for (const
|
|
21422
|
+
for (const resolve17 of waiters.values()) resolve17({ approved: false, guidance: reason });
|
|
21390
21423
|
}
|
|
21391
21424
|
for (const waiters of this.agentOpWaiters.values()) {
|
|
21392
21425
|
for (const waiter of waiters.values()) {
|
|
@@ -21412,9 +21445,9 @@ var HostClient = class _HostClient {
|
|
|
21412
21445
|
let drainTimer;
|
|
21413
21446
|
const drained = await Promise.race([
|
|
21414
21447
|
Promise.allSettled(runs).then(() => true),
|
|
21415
|
-
new Promise((
|
|
21448
|
+
new Promise((resolve17) => {
|
|
21416
21449
|
drainTimer = setTimeout(
|
|
21417
|
-
() =>
|
|
21450
|
+
() => resolve17(false),
|
|
21418
21451
|
this.opts.unwindTimeoutMs ?? _HostClient.DEFAULT_UNWIND_TIMEOUT_MS
|
|
21419
21452
|
);
|
|
21420
21453
|
drainTimer.unref?.();
|
|
@@ -21558,9 +21591,9 @@ var HostClient = class _HostClient {
|
|
|
21558
21591
|
let frameDrainTimer;
|
|
21559
21592
|
const framesDrained = await Promise.race([
|
|
21560
21593
|
frameTail.then(() => true),
|
|
21561
|
-
new Promise((
|
|
21594
|
+
new Promise((resolve17) => {
|
|
21562
21595
|
frameDrainTimer = setTimeout(
|
|
21563
|
-
() =>
|
|
21596
|
+
() => resolve17(false),
|
|
21564
21597
|
this.opts.unwindTimeoutMs ?? _HostClient.DEFAULT_UNWIND_TIMEOUT_MS
|
|
21565
21598
|
);
|
|
21566
21599
|
frameDrainTimer.unref?.();
|
|
@@ -22104,7 +22137,7 @@ var HostClient = class _HostClient {
|
|
|
22104
22137
|
const entry = this.secretGrants.get(key) ?? { resolvers: [] };
|
|
22105
22138
|
entry.value = message.secrets;
|
|
22106
22139
|
entry.expiresAt = expiresAt;
|
|
22107
|
-
for (const
|
|
22140
|
+
for (const resolve17 of entry.resolvers) resolve17(message.secrets);
|
|
22108
22141
|
entry.resolvers = [];
|
|
22109
22142
|
this.secretGrants.set(key, entry);
|
|
22110
22143
|
return;
|
|
@@ -22135,13 +22168,13 @@ var HostClient = class _HostClient {
|
|
|
22135
22168
|
const entry = this.connectionGrants.get(key) ?? { resolvers: [] };
|
|
22136
22169
|
entry.value = message.connections;
|
|
22137
22170
|
entry.expiresAt = expiresAt;
|
|
22138
|
-
for (const
|
|
22171
|
+
for (const resolve17 of entry.resolvers) resolve17(message.connections);
|
|
22139
22172
|
entry.resolvers = [];
|
|
22140
22173
|
this.connectionGrants.set(key, entry);
|
|
22141
22174
|
const providerEntry = this.providerGrants.get(key) ?? { resolvers: [] };
|
|
22142
22175
|
providerEntry.value = providers;
|
|
22143
22176
|
providerEntry.expiresAt = authorityExpiresAt;
|
|
22144
|
-
for (const
|
|
22177
|
+
for (const resolve17 of providerEntry.resolvers) resolve17(providers);
|
|
22145
22178
|
providerEntry.resolvers = [];
|
|
22146
22179
|
this.providerGrants.set(key, providerEntry);
|
|
22147
22180
|
return;
|
|
@@ -22275,8 +22308,8 @@ var HostClient = class _HostClient {
|
|
|
22275
22308
|
return redactCredentialText(text, sensitiveSnapshot()).slice(0, maxLength);
|
|
22276
22309
|
};
|
|
22277
22310
|
let resolveCancelled;
|
|
22278
|
-
const cancelledPromise = new Promise((
|
|
22279
|
-
resolveCancelled =
|
|
22311
|
+
const cancelledPromise = new Promise((resolve17) => {
|
|
22312
|
+
resolveCancelled = resolve17;
|
|
22280
22313
|
});
|
|
22281
22314
|
const endAuthority = (reason = "cloud_cancel") => {
|
|
22282
22315
|
if (stopReason) return;
|
|
@@ -22285,21 +22318,21 @@ var HostClient = class _HostClient {
|
|
|
22285
22318
|
authorityController.abort(reason);
|
|
22286
22319
|
const secretEntry = this.secretGrants.get(cancelKey);
|
|
22287
22320
|
if (secretEntry) {
|
|
22288
|
-
for (const
|
|
22321
|
+
for (const resolve17 of secretEntry.resolvers) resolve17({});
|
|
22289
22322
|
secretEntry.resolvers = [];
|
|
22290
22323
|
delete secretEntry.value;
|
|
22291
22324
|
}
|
|
22292
22325
|
this.secretGrants.delete(cancelKey);
|
|
22293
22326
|
const connectionEntry = this.connectionGrants.get(cancelKey);
|
|
22294
22327
|
if (connectionEntry) {
|
|
22295
|
-
for (const
|
|
22328
|
+
for (const resolve17 of connectionEntry.resolvers) resolve17([]);
|
|
22296
22329
|
connectionEntry.resolvers = [];
|
|
22297
22330
|
delete connectionEntry.value;
|
|
22298
22331
|
}
|
|
22299
22332
|
this.connectionGrants.delete(cancelKey);
|
|
22300
22333
|
const providerEntry = this.providerGrants.get(cancelKey);
|
|
22301
22334
|
if (providerEntry) {
|
|
22302
|
-
for (const
|
|
22335
|
+
for (const resolve17 of providerEntry.resolvers) resolve17([]);
|
|
22303
22336
|
providerEntry.resolvers = [];
|
|
22304
22337
|
delete providerEntry.value;
|
|
22305
22338
|
}
|
|
@@ -22307,8 +22340,8 @@ var HostClient = class _HostClient {
|
|
|
22307
22340
|
this.clearAuthorityExpiry(cancelKey);
|
|
22308
22341
|
const approvalWaiters = this.approvalWaiters.get(cancelKey);
|
|
22309
22342
|
if (approvalWaiters) {
|
|
22310
|
-
for (const
|
|
22311
|
-
|
|
22343
|
+
for (const resolve17 of approvalWaiters.values()) {
|
|
22344
|
+
resolve17({ approved: false, guidance: "task was cancelled" });
|
|
22312
22345
|
}
|
|
22313
22346
|
approvalWaiters.clear();
|
|
22314
22347
|
}
|
|
@@ -22434,9 +22467,9 @@ var HostClient = class _HostClient {
|
|
|
22434
22467
|
return value;
|
|
22435
22468
|
};
|
|
22436
22469
|
if (entry.value) return Promise.resolve(capture(entry.value));
|
|
22437
|
-
return new Promise((
|
|
22438
|
-
entry.resolvers.push((value) =>
|
|
22439
|
-
setTimeout(() =>
|
|
22470
|
+
return new Promise((resolve17) => {
|
|
22471
|
+
entry.resolvers.push((value) => resolve17(capture(value)));
|
|
22472
|
+
setTimeout(() => resolve17(capture(entry.value ?? {})), _HostClient.SECRETS_WAIT_MS);
|
|
22440
22473
|
});
|
|
22441
22474
|
};
|
|
22442
22475
|
const connections = () => {
|
|
@@ -22453,9 +22486,9 @@ var HostClient = class _HostClient {
|
|
|
22453
22486
|
return value;
|
|
22454
22487
|
};
|
|
22455
22488
|
if (entry.value) return Promise.resolve(capture(entry.value));
|
|
22456
|
-
return new Promise((
|
|
22457
|
-
entry.resolvers.push((value) =>
|
|
22458
|
-
setTimeout(() =>
|
|
22489
|
+
return new Promise((resolve17) => {
|
|
22490
|
+
entry.resolvers.push((value) => resolve17(capture(value)));
|
|
22491
|
+
setTimeout(() => resolve17(capture(entry.value ?? [])), _HostClient.SECRETS_WAIT_MS);
|
|
22459
22492
|
});
|
|
22460
22493
|
};
|
|
22461
22494
|
const providers = () => {
|
|
@@ -22472,9 +22505,9 @@ var HostClient = class _HostClient {
|
|
|
22472
22505
|
return value;
|
|
22473
22506
|
};
|
|
22474
22507
|
if (entry.value !== void 0) return Promise.resolve(capture(entry.value));
|
|
22475
|
-
return new Promise((
|
|
22476
|
-
entry.resolvers.push((value) =>
|
|
22477
|
-
setTimeout(() =>
|
|
22508
|
+
return new Promise((resolve17) => {
|
|
22509
|
+
entry.resolvers.push((value) => resolve17(capture(value)));
|
|
22510
|
+
setTimeout(() => resolve17(capture(entry.value ?? [])), _HostClient.SECRETS_WAIT_MS);
|
|
22478
22511
|
});
|
|
22479
22512
|
};
|
|
22480
22513
|
const linear = async () => {
|
|
@@ -22500,13 +22533,13 @@ var HostClient = class _HostClient {
|
|
|
22500
22533
|
payload: safe(payload, 5e4),
|
|
22501
22534
|
...questionChoices ? { questionChoices: [...questionChoices] } : {}
|
|
22502
22535
|
});
|
|
22503
|
-
return new Promise((
|
|
22536
|
+
return new Promise((resolve17) => {
|
|
22504
22537
|
const waiters = this.approvalWaiters.get(cancelKey) ?? /* @__PURE__ */ new Map();
|
|
22505
22538
|
this.approvalWaiters.set(cancelKey, waiters);
|
|
22506
|
-
waiters.set(requestId,
|
|
22539
|
+
waiters.set(requestId, resolve17);
|
|
22507
22540
|
void cancelledPromise.then(() => {
|
|
22508
22541
|
if (waiters.delete(requestId)) {
|
|
22509
|
-
|
|
22542
|
+
resolve17({ approved: false, guidance: "task was cancelled" });
|
|
22510
22543
|
}
|
|
22511
22544
|
});
|
|
22512
22545
|
});
|
|
@@ -22552,11 +22585,11 @@ var HostClient = class _HostClient {
|
|
|
22552
22585
|
if (existing) message = existing;
|
|
22553
22586
|
else terminalMessages.set(requestId, message);
|
|
22554
22587
|
}
|
|
22555
|
-
return new Promise((
|
|
22588
|
+
return new Promise((resolve17) => {
|
|
22556
22589
|
const waiters = this.agentOpWaiters.get(cancelKey) ?? /* @__PURE__ */ new Map();
|
|
22557
22590
|
this.agentOpWaiters.set(cancelKey, waiters);
|
|
22558
22591
|
if (waiters.has(requestId)) {
|
|
22559
|
-
|
|
22592
|
+
resolve17({ ok: false, error: "provider settlement request is already in flight" });
|
|
22560
22593
|
return;
|
|
22561
22594
|
}
|
|
22562
22595
|
const timer = setTimeout(() => {
|
|
@@ -22567,7 +22600,7 @@ var HostClient = class _HostClient {
|
|
|
22567
22600
|
(pending) => !(pending.type === "agent.op" && pending.requestId === requestId)
|
|
22568
22601
|
);
|
|
22569
22602
|
}
|
|
22570
|
-
|
|
22603
|
+
resolve17({
|
|
22571
22604
|
ok: false,
|
|
22572
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"
|
|
22573
22606
|
});
|
|
@@ -22575,7 +22608,7 @@ var HostClient = class _HostClient {
|
|
|
22575
22608
|
}, _HostClient.AGENT_OP_TIMEOUT_MS);
|
|
22576
22609
|
timer.unref?.();
|
|
22577
22610
|
waiters.set(requestId, {
|
|
22578
|
-
resolve:
|
|
22611
|
+
resolve: resolve17,
|
|
22579
22612
|
timer,
|
|
22580
22613
|
...terminal ? { terminalMessage: message } : {}
|
|
22581
22614
|
});
|
|
@@ -22621,12 +22654,12 @@ var HostClient = class _HostClient {
|
|
|
22621
22654
|
"No GitHub change was attempted; the authority grant request was invalid."
|
|
22622
22655
|
);
|
|
22623
22656
|
}
|
|
22624
|
-
const outcome = await new Promise((
|
|
22657
|
+
const outcome = await new Promise((resolve17) => {
|
|
22625
22658
|
const timer = setTimeout(() => {
|
|
22626
22659
|
const waiter = this.operationGrantWaiters.get(requestId);
|
|
22627
22660
|
if (!waiter) return;
|
|
22628
22661
|
this.operationGrantWaiters.delete(requestId);
|
|
22629
|
-
|
|
22662
|
+
resolve17({ grant: null, retryable: true, reason: "no_reply_from_zixt" });
|
|
22630
22663
|
}, this.operationGrantTimeoutMs);
|
|
22631
22664
|
timer.unref?.();
|
|
22632
22665
|
this.operationGrantWaiters.set(requestId, {
|
|
@@ -22639,9 +22672,9 @@ var HostClient = class _HostClient {
|
|
|
22639
22672
|
timer,
|
|
22640
22673
|
accept: (grant) => {
|
|
22641
22674
|
addSensitiveValues(providerGrantSensitiveValues(grant));
|
|
22642
|
-
|
|
22675
|
+
resolve17({ grant });
|
|
22643
22676
|
},
|
|
22644
|
-
deny: (retryable, reason, detail, retryAt, retryCode) =>
|
|
22677
|
+
deny: (retryable, reason, detail, retryAt, retryCode) => resolve17({
|
|
22645
22678
|
grant: null,
|
|
22646
22679
|
retryable,
|
|
22647
22680
|
reason,
|
|
@@ -22655,7 +22688,7 @@ var HostClient = class _HostClient {
|
|
|
22655
22688
|
} catch {
|
|
22656
22689
|
clearTimeout(timer);
|
|
22657
22690
|
this.operationGrantWaiters.delete(requestId);
|
|
22658
|
-
|
|
22691
|
+
resolve17({ grant: null, retryable: false, reason: "connection_unavailable" });
|
|
22659
22692
|
}
|
|
22660
22693
|
});
|
|
22661
22694
|
if (outcome.grant) {
|
|
@@ -22711,7 +22744,7 @@ var HostClient = class _HostClient {
|
|
|
22711
22744
|
)
|
|
22712
22745
|
);
|
|
22713
22746
|
}
|
|
22714
|
-
return new Promise((
|
|
22747
|
+
return new Promise((resolve17, reject3) => {
|
|
22715
22748
|
const timer = setTimeout(() => {
|
|
22716
22749
|
if (this.browserCredentialWaiters.delete(requestId)) {
|
|
22717
22750
|
reject3(
|
|
@@ -22730,7 +22763,7 @@ var HostClient = class _HostClient {
|
|
|
22730
22763
|
timer,
|
|
22731
22764
|
accept: (credential) => {
|
|
22732
22765
|
addSensitiveValues(webLoginSensitiveValues(credential));
|
|
22733
|
-
|
|
22766
|
+
resolve17(credential);
|
|
22734
22767
|
},
|
|
22735
22768
|
deny: (reason) => reject3(new Error(reason))
|
|
22736
22769
|
});
|
|
@@ -23051,14 +23084,14 @@ async function observeWindowsGuardianNonce(pid, nonce) {
|
|
|
23051
23084
|
"Windows runner identity could not be observed"
|
|
23052
23085
|
);
|
|
23053
23086
|
}
|
|
23054
|
-
return new Promise((
|
|
23087
|
+
return new Promise((resolve17, reject3) => {
|
|
23055
23088
|
let done = false;
|
|
23056
23089
|
const finish = (result) => {
|
|
23057
23090
|
if (done) return;
|
|
23058
23091
|
done = true;
|
|
23059
23092
|
clearTimeout(timeout);
|
|
23060
23093
|
if (result instanceof Error) reject3(result);
|
|
23061
|
-
else
|
|
23094
|
+
else resolve17(result);
|
|
23062
23095
|
};
|
|
23063
23096
|
const timeout = setTimeout(
|
|
23064
23097
|
() => finish(
|
|
@@ -23103,7 +23136,7 @@ async function observePosixGuardianNonce(pid, nonce) {
|
|
|
23103
23136
|
);
|
|
23104
23137
|
}
|
|
23105
23138
|
}
|
|
23106
|
-
return new Promise((
|
|
23139
|
+
return new Promise((resolve17, reject3) => {
|
|
23107
23140
|
const observer = spawn2("/bin/ps", ["-ww", "-o", "command=", "-p", String(pid)], {
|
|
23108
23141
|
stdio: ["ignore", "pipe", "ignore"]
|
|
23109
23142
|
});
|
|
@@ -23114,7 +23147,7 @@ async function observePosixGuardianNonce(pid, nonce) {
|
|
|
23114
23147
|
done = true;
|
|
23115
23148
|
clearTimeout(timeout);
|
|
23116
23149
|
if (result instanceof Error) reject3(result);
|
|
23117
|
-
else
|
|
23150
|
+
else resolve17(result);
|
|
23118
23151
|
};
|
|
23119
23152
|
const timeout = setTimeout(() => {
|
|
23120
23153
|
observer.kill("SIGKILL");
|
|
@@ -23161,7 +23194,7 @@ async function observeGuardianIdentity(pid, identity) {
|
|
|
23161
23194
|
return process.platform === "win32" ? observeWindowsGuardianNonce(pid, identity.nonce) : observePosixGuardianNonce(pid, identity.nonce);
|
|
23162
23195
|
}
|
|
23163
23196
|
function delay(ms) {
|
|
23164
|
-
return new Promise((
|
|
23197
|
+
return new Promise((resolve17) => setTimeout(resolve17, ms));
|
|
23165
23198
|
}
|
|
23166
23199
|
function posixProcessRecordsFromPs(output) {
|
|
23167
23200
|
const records = [];
|
|
@@ -23194,7 +23227,7 @@ function posixProcessRecordsFromPs(output) {
|
|
|
23194
23227
|
return records;
|
|
23195
23228
|
}
|
|
23196
23229
|
async function snapshotPosixProcesses() {
|
|
23197
|
-
return new Promise((
|
|
23230
|
+
return new Promise((resolve17, reject3) => {
|
|
23198
23231
|
const observer = spawn2("/bin/ps", ["-axo", "uid=,pid=,ppid=,pgid=,stat="], {
|
|
23199
23232
|
stdio: ["ignore", "pipe", "ignore"]
|
|
23200
23233
|
});
|
|
@@ -23207,7 +23240,7 @@ async function snapshotPosixProcesses() {
|
|
|
23207
23240
|
if (error52) reject3(error52);
|
|
23208
23241
|
else {
|
|
23209
23242
|
try {
|
|
23210
|
-
|
|
23243
|
+
resolve17(posixProcessRecordsFromPs(output));
|
|
23211
23244
|
} catch (caught) {
|
|
23212
23245
|
reject3(caught);
|
|
23213
23246
|
}
|
|
@@ -23542,7 +23575,7 @@ async function snapshotWindowsDescendants(rootPid) {
|
|
|
23542
23575
|
"Windows process-tree observation could not start"
|
|
23543
23576
|
);
|
|
23544
23577
|
}
|
|
23545
|
-
return new Promise((
|
|
23578
|
+
return new Promise((resolve17, reject3) => {
|
|
23546
23579
|
let done = false;
|
|
23547
23580
|
const timeout = setTimeout(() => {
|
|
23548
23581
|
if (done) return;
|
|
@@ -23569,7 +23602,7 @@ async function snapshotWindowsDescendants(rootPid) {
|
|
|
23569
23602
|
return;
|
|
23570
23603
|
}
|
|
23571
23604
|
try {
|
|
23572
|
-
|
|
23605
|
+
resolve17(completeWindowsDescendantPids(rootPid, processes));
|
|
23573
23606
|
} catch (caught) {
|
|
23574
23607
|
reject3(caught);
|
|
23575
23608
|
}
|
|
@@ -23616,7 +23649,7 @@ async function waitForProcessesExit(pids, timeoutMs) {
|
|
|
23616
23649
|
}
|
|
23617
23650
|
async function runTaskkill(pid, command, timeoutMs = TASKKILL_TIMEOUT_MS, independentlyTrackedPids = []) {
|
|
23618
23651
|
const trustedCommand = command ?? defaultTaskkillCommand();
|
|
23619
|
-
const result = await new Promise((
|
|
23652
|
+
const result = await new Promise((resolve17, reject3) => {
|
|
23620
23653
|
const killer = spawn2(trustedCommand, ["/PID", String(pid), "/T", "/F"], {
|
|
23621
23654
|
stdio: ["ignore", "pipe", "pipe"],
|
|
23622
23655
|
windowsHide: true
|
|
@@ -23651,7 +23684,7 @@ async function runTaskkill(pid, command, timeoutMs = TASKKILL_TIMEOUT_MS, indepe
|
|
|
23651
23684
|
done = true;
|
|
23652
23685
|
clearTimeout(timeout);
|
|
23653
23686
|
if (error52) reject3(error52);
|
|
23654
|
-
else
|
|
23687
|
+
else resolve17({ code: killer.exitCode, output, outputTruncated });
|
|
23655
23688
|
};
|
|
23656
23689
|
killer.once(
|
|
23657
23690
|
"error",
|
|
@@ -24328,12 +24361,12 @@ async function createWindowsJobContainment(pid, options) {
|
|
|
24328
24361
|
stderr = `${stderr}${String(chunk)}`.slice(-HELPER_OUTPUT_LIMIT);
|
|
24329
24362
|
});
|
|
24330
24363
|
const helperEvents = helper;
|
|
24331
|
-
const exited = new Promise((
|
|
24364
|
+
const exited = new Promise((resolve17) => {
|
|
24332
24365
|
let completed = false;
|
|
24333
24366
|
const complete = (code, signal) => {
|
|
24334
24367
|
if (completed) return;
|
|
24335
24368
|
completed = true;
|
|
24336
|
-
|
|
24369
|
+
resolve17({ code, signal });
|
|
24337
24370
|
};
|
|
24338
24371
|
helperEvents.once("error", () => {
|
|
24339
24372
|
failProtocol(new Error("Windows Job Object helper could not start"));
|
|
@@ -24346,7 +24379,7 @@ async function createWindowsJobContainment(pid, options) {
|
|
|
24346
24379
|
});
|
|
24347
24380
|
const nextLine = async (expected) => {
|
|
24348
24381
|
if (protocolFailure) throw protocolFailure;
|
|
24349
|
-
const line = lines.shift() ?? await new Promise((
|
|
24382
|
+
const line = lines.shift() ?? await new Promise((resolve17, reject3) => {
|
|
24350
24383
|
const timer = setTimeout(
|
|
24351
24384
|
() => reject3(timeoutError("Windows Job Object helper did not answer in time")),
|
|
24352
24385
|
timeoutMs
|
|
@@ -24354,7 +24387,7 @@ async function createWindowsJobContainment(pid, options) {
|
|
|
24354
24387
|
timer.unref?.();
|
|
24355
24388
|
lineWaiters.push((value) => {
|
|
24356
24389
|
clearTimeout(timer);
|
|
24357
|
-
|
|
24390
|
+
resolve17(value);
|
|
24358
24391
|
});
|
|
24359
24392
|
});
|
|
24360
24393
|
if (protocolFailure) throw protocolFailure;
|
|
@@ -24367,8 +24400,8 @@ async function createWindowsJobContainment(pid, options) {
|
|
|
24367
24400
|
}
|
|
24368
24401
|
const stopped = await Promise.race([
|
|
24369
24402
|
exited.then(() => true),
|
|
24370
|
-
new Promise((
|
|
24371
|
-
const timer = setTimeout(() =>
|
|
24403
|
+
new Promise((resolve17) => {
|
|
24404
|
+
const timer = setTimeout(() => resolve17(false), timeoutMs);
|
|
24372
24405
|
timer.unref?.();
|
|
24373
24406
|
})
|
|
24374
24407
|
]);
|
|
@@ -24427,7 +24460,7 @@ async function awaitWindowsContainmentGate(env = process.env, input = process.st
|
|
|
24427
24460
|
if (nonce === void 0) return true;
|
|
24428
24461
|
if (!SAFE_NONCE2.test(nonce)) return false;
|
|
24429
24462
|
const expected = windowsContainmentGate(nonce).trimEnd();
|
|
24430
|
-
return new Promise((
|
|
24463
|
+
return new Promise((resolve17) => {
|
|
24431
24464
|
let pending = Buffer.alloc(0);
|
|
24432
24465
|
let settled = false;
|
|
24433
24466
|
const finish = (result) => {
|
|
@@ -24438,7 +24471,7 @@ async function awaitWindowsContainmentGate(env = process.env, input = process.st
|
|
|
24438
24471
|
input.off("end", onEnd);
|
|
24439
24472
|
input.off("error", onEnd);
|
|
24440
24473
|
if (result) input.pause();
|
|
24441
|
-
|
|
24474
|
+
resolve17(result);
|
|
24442
24475
|
};
|
|
24443
24476
|
const onData = (chunk) => {
|
|
24444
24477
|
pending = Buffer.concat([pending, chunk]);
|
|
@@ -24863,7 +24896,7 @@ async function installRelease(version2, options = {}) {
|
|
|
24863
24896
|
installerContainmentSetupError = error52;
|
|
24864
24897
|
return null;
|
|
24865
24898
|
}) : Promise.resolve(null);
|
|
24866
|
-
const installed = await new Promise((
|
|
24899
|
+
const installed = await new Promise((resolve17, reject3) => {
|
|
24867
24900
|
let finished = false;
|
|
24868
24901
|
let cleanupStarted = false;
|
|
24869
24902
|
let exitObserved = false;
|
|
@@ -24879,7 +24912,7 @@ async function installRelease(version2, options = {}) {
|
|
|
24879
24912
|
finished = true;
|
|
24880
24913
|
clearTimeout(timer);
|
|
24881
24914
|
options.signal?.removeEventListener("abort", requestCleanup);
|
|
24882
|
-
|
|
24915
|
+
resolve17(result);
|
|
24883
24916
|
};
|
|
24884
24917
|
const requestCleanup = () => {
|
|
24885
24918
|
if (cleanupStarted || finished) return;
|
|
@@ -25192,11 +25225,11 @@ async function runWorkerCompatibilityProxy(env = process.env, argv = process.arg
|
|
|
25192
25225
|
child.stdin?.on("error", () => {
|
|
25193
25226
|
});
|
|
25194
25227
|
process.stdin.pipe(child.stdin);
|
|
25195
|
-
return new Promise((
|
|
25196
|
-
child.once("error", () =>
|
|
25228
|
+
return new Promise((resolve17) => {
|
|
25229
|
+
child.once("error", () => resolve17(1));
|
|
25197
25230
|
child.once("exit", (code) => {
|
|
25198
25231
|
process.stdin.unpipe(child.stdin);
|
|
25199
|
-
|
|
25232
|
+
resolve17(code ?? 1);
|
|
25200
25233
|
});
|
|
25201
25234
|
});
|
|
25202
25235
|
}
|
|
@@ -25275,11 +25308,11 @@ async function launchHostSupervisor(options = {}) {
|
|
|
25275
25308
|
const waitOrStop = async (ms) => {
|
|
25276
25309
|
if (stopping) return false;
|
|
25277
25310
|
if (!customDelay) {
|
|
25278
|
-
await new Promise((
|
|
25311
|
+
await new Promise((resolve17) => {
|
|
25279
25312
|
const finish = () => {
|
|
25280
25313
|
clearTimeout(timer);
|
|
25281
25314
|
stopController.signal.removeEventListener("abort", finish);
|
|
25282
|
-
|
|
25315
|
+
resolve17();
|
|
25283
25316
|
};
|
|
25284
25317
|
const timer = setTimeout(finish, ms);
|
|
25285
25318
|
stopController.signal.addEventListener("abort", finish, { once: true });
|
|
@@ -25287,8 +25320,8 @@ async function launchHostSupervisor(options = {}) {
|
|
|
25287
25320
|
return !stopping;
|
|
25288
25321
|
}
|
|
25289
25322
|
let finishStop;
|
|
25290
|
-
const stopped = new Promise((
|
|
25291
|
-
finishStop = () =>
|
|
25323
|
+
const stopped = new Promise((resolve17) => {
|
|
25324
|
+
finishStop = () => resolve17();
|
|
25292
25325
|
stopController.signal.addEventListener("abort", finishStop, { once: true });
|
|
25293
25326
|
});
|
|
25294
25327
|
await Promise.race([customDelay(ms), stopped]);
|
|
@@ -25414,19 +25447,19 @@ async function launchHostSupervisor(options = {}) {
|
|
|
25414
25447
|
child = spawnSupervisor(entry, version2, ownershipDirectory, containmentGateNonce);
|
|
25415
25448
|
const launchedSupervisor = child;
|
|
25416
25449
|
let resolveChildExited;
|
|
25417
|
-
const childExited = new Promise((
|
|
25418
|
-
resolveChildExited =
|
|
25450
|
+
const childExited = new Promise((resolve17) => {
|
|
25451
|
+
resolveChildExited = resolve17;
|
|
25419
25452
|
});
|
|
25420
25453
|
const supervisorContainmentAbort = new AbortController();
|
|
25421
25454
|
void childExited.then(() => supervisorContainmentAbort.abort());
|
|
25422
25455
|
const outcomePromise = new Promise(
|
|
25423
|
-
(
|
|
25456
|
+
(resolve17) => {
|
|
25424
25457
|
let observed = false;
|
|
25425
25458
|
const finish = (code, signal) => {
|
|
25426
25459
|
if (observed) return;
|
|
25427
25460
|
observed = true;
|
|
25428
25461
|
resolveChildExited();
|
|
25429
|
-
|
|
25462
|
+
resolve17({ code, signal });
|
|
25430
25463
|
};
|
|
25431
25464
|
child.once("error", () => finish(1, null));
|
|
25432
25465
|
child.once("exit", finish);
|
|
@@ -25447,12 +25480,12 @@ async function launchHostSupervisor(options = {}) {
|
|
|
25447
25480
|
if (!supervisorContainment || !launchedSupervisor.stdin) {
|
|
25448
25481
|
throw new Error("supervisor Job Object gate is unavailable");
|
|
25449
25482
|
}
|
|
25450
|
-
await new Promise((
|
|
25483
|
+
await new Promise((resolve17, reject3) => {
|
|
25451
25484
|
launchedSupervisor.stdin.write(
|
|
25452
25485
|
windowsContainmentGate(containmentGateNonce),
|
|
25453
25486
|
(error52) => {
|
|
25454
25487
|
if (error52) reject3(error52);
|
|
25455
|
-
else
|
|
25488
|
+
else resolve17();
|
|
25456
25489
|
}
|
|
25457
25490
|
);
|
|
25458
25491
|
});
|
|
@@ -25594,18 +25627,18 @@ async function superviseHost(options = {}) {
|
|
|
25594
25627
|
}
|
|
25595
25628
|
}
|
|
25596
25629
|
let announceShutdown;
|
|
25597
|
-
const shutdownAnnounced = new Promise((
|
|
25598
|
-
announceShutdown =
|
|
25630
|
+
const shutdownAnnounced = new Promise((resolve17) => {
|
|
25631
|
+
announceShutdown = resolve17;
|
|
25599
25632
|
});
|
|
25600
25633
|
const attempted = /* @__PURE__ */ new Set();
|
|
25601
25634
|
const waitOrShutdown = async (ms) => {
|
|
25602
25635
|
if (shuttingDown2) return false;
|
|
25603
25636
|
if (!customDelay) {
|
|
25604
|
-
await new Promise((
|
|
25637
|
+
await new Promise((resolve17) => {
|
|
25605
25638
|
const finish = () => {
|
|
25606
25639
|
clearTimeout(timer);
|
|
25607
25640
|
shutdownController.signal.removeEventListener("abort", finish);
|
|
25608
|
-
|
|
25641
|
+
resolve17();
|
|
25609
25642
|
};
|
|
25610
25643
|
const timer = setTimeout(finish, ms);
|
|
25611
25644
|
shutdownController.signal.addEventListener("abort", finish, { once: true });
|
|
@@ -25748,19 +25781,19 @@ async function superviseHost(options = {}) {
|
|
|
25748
25781
|
child = spawnWorker(command, watchdogLaunch, compatibilityOwnership, containmentGateNonce);
|
|
25749
25782
|
const watchedChild = child;
|
|
25750
25783
|
let resolveChildExited;
|
|
25751
|
-
const childExited = new Promise((
|
|
25752
|
-
resolveChildExited =
|
|
25784
|
+
const childExited = new Promise((resolve17) => {
|
|
25785
|
+
resolveChildExited = resolve17;
|
|
25753
25786
|
});
|
|
25754
25787
|
const workerContainmentAbort = new AbortController();
|
|
25755
25788
|
void childExited.then(() => workerContainmentAbort.abort());
|
|
25756
25789
|
const outcomePromise = new Promise(
|
|
25757
|
-
(
|
|
25790
|
+
(resolve17) => {
|
|
25758
25791
|
let observed = false;
|
|
25759
25792
|
const finish = (result) => {
|
|
25760
25793
|
if (observed) return;
|
|
25761
25794
|
observed = true;
|
|
25762
25795
|
resolveChildExited();
|
|
25763
|
-
|
|
25796
|
+
resolve17(result);
|
|
25764
25797
|
};
|
|
25765
25798
|
watchedChild.once("error", () => finish({ code: 1, signal: null }));
|
|
25766
25799
|
watchedChild.once(
|
|
@@ -25782,10 +25815,10 @@ async function superviseHost(options = {}) {
|
|
|
25782
25815
|
if (!workerContainment || !watchedChild.stdin) {
|
|
25783
25816
|
throw new Error("worker Job Object gate is unavailable");
|
|
25784
25817
|
}
|
|
25785
|
-
await new Promise((
|
|
25818
|
+
await new Promise((resolve17, reject3) => {
|
|
25786
25819
|
watchedChild.stdin.write(windowsContainmentGate(containmentGateNonce), (error52) => {
|
|
25787
25820
|
if (error52) reject3(error52);
|
|
25788
|
-
else
|
|
25821
|
+
else resolve17();
|
|
25789
25822
|
});
|
|
25790
25823
|
});
|
|
25791
25824
|
}
|
|
@@ -26049,7 +26082,47 @@ async function superviseHost(options = {}) {
|
|
|
26049
26082
|
}
|
|
26050
26083
|
|
|
26051
26084
|
// src/index.ts
|
|
26052
|
-
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
|
+
}
|
|
26053
26126
|
|
|
26054
26127
|
// src/browser/adapter.ts
|
|
26055
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.";
|
|
@@ -26239,15 +26312,15 @@ function createDemoBrowserAdapterFactory() {
|
|
|
26239
26312
|
|
|
26240
26313
|
// src/browser/manager.ts
|
|
26241
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";
|
|
26242
|
-
import { homedir as
|
|
26243
|
-
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";
|
|
26244
26317
|
var SAFE_SEGMENT = /^[A-Za-z0-9_-]{1,200}$/;
|
|
26245
26318
|
var FRAME_MIN_INTERVAL_MS = 100;
|
|
26246
26319
|
var IDLE_TIMEOUT_MS = 15 * 6e4;
|
|
26247
26320
|
var BrowserManager = class {
|
|
26248
26321
|
constructor(opts) {
|
|
26249
26322
|
this.opts = opts;
|
|
26250
|
-
this.profileRoot = opts.profileRoot ?? join7(
|
|
26323
|
+
this.profileRoot = opts.profileRoot ?? join7(homedir3(), ".zixt", "browser-profiles");
|
|
26251
26324
|
this.profileStateRoot = join7(this.profileRoot, ".profile-state");
|
|
26252
26325
|
this.viewport = opts.viewport ?? BROWSER_DEFAULT_VIEWPORT;
|
|
26253
26326
|
this.idleTimeoutMs = opts.idleTimeoutMs ?? IDLE_TIMEOUT_MS;
|
|
@@ -26338,9 +26411,9 @@ var BrowserManager = class {
|
|
|
26338
26411
|
}
|
|
26339
26412
|
}
|
|
26340
26413
|
exactChild(root, child) {
|
|
26341
|
-
const canonicalRoot =
|
|
26342
|
-
const target =
|
|
26343
|
-
if (
|
|
26414
|
+
const canonicalRoot = resolve6(root);
|
|
26415
|
+
const target = resolve6(canonicalRoot, child);
|
|
26416
|
+
if (dirname5(target) !== canonicalRoot) {
|
|
26344
26417
|
throw new Error("browser profile path escaped its owned root");
|
|
26345
26418
|
}
|
|
26346
26419
|
return target;
|
|
@@ -27249,8 +27322,8 @@ function createPlaywrightBrowserAdapterFactory(dependencies = {}) {
|
|
|
27249
27322
|
import { spawn as spawn8 } from "node:child_process";
|
|
27250
27323
|
import { randomUUID as randomUUID10 } from "node:crypto";
|
|
27251
27324
|
import { lstat as lstat11, mkdir as mkdir10, realpath as realpath8 } from "node:fs/promises";
|
|
27252
|
-
import { homedir as
|
|
27253
|
-
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";
|
|
27254
27327
|
|
|
27255
27328
|
// src/tool-packs/browser/authentication-wall.ts
|
|
27256
27329
|
var AUTH_PATH_SEGMENT = /(?:^|\/)(?:log[-_]?in|sign[-_]?in|sso|saml|auth|authorize|authenticate|oauth2?|session\/new|checkpoint)(?:\/|$)/i;
|
|
@@ -29976,7 +30049,7 @@ function createGithubPushOrchestrator(input) {
|
|
|
29976
30049
|
import { spawn as spawn5 } from "node:child_process";
|
|
29977
30050
|
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
29978
30051
|
import { chmod as chmod3, lstat as lstat7, mkdir as mkdir5, realpath as realpath4, rm as rm5 } from "node:fs/promises";
|
|
29979
|
-
import { dirname as
|
|
30052
|
+
import { dirname as dirname6, isAbsolute as isAbsolute9, join as join9, relative as relative5 } from "node:path";
|
|
29980
30053
|
|
|
29981
30054
|
// src/tool-packs/github/git-credential-broker.ts
|
|
29982
30055
|
import { createServer } from "node:http";
|
|
@@ -30227,7 +30300,7 @@ async function requireRealDirectory(path, label) {
|
|
|
30227
30300
|
async function validateTokenlessPaths(command) {
|
|
30228
30301
|
if (command.kind === "clone-from-bridge") {
|
|
30229
30302
|
if (!isAbsolute9(command.destination)) throw new GithubGitProcessError("invalid_input");
|
|
30230
|
-
const parent = await requireRealDirectory(
|
|
30303
|
+
const parent = await requireRealDirectory(dirname6(command.destination), "clone parent");
|
|
30231
30304
|
assertBelow(parent, command.destination, "clone destination");
|
|
30232
30305
|
const destination = await lstat7(command.destination).catch((error52) => {
|
|
30233
30306
|
if (error52.code === "ENOENT") return null;
|
|
@@ -30337,8 +30410,8 @@ async function runGit(input, args, env) {
|
|
|
30337
30410
|
let settled = false;
|
|
30338
30411
|
let stopping = false;
|
|
30339
30412
|
let resolveExited;
|
|
30340
|
-
const exited = new Promise((
|
|
30341
|
-
resolveExited =
|
|
30413
|
+
const exited = new Promise((resolve17) => {
|
|
30414
|
+
resolveExited = resolve17;
|
|
30342
30415
|
});
|
|
30343
30416
|
child.once("exit", resolveExited);
|
|
30344
30417
|
const cleanup = () => {
|
|
@@ -30986,7 +31059,7 @@ function createRepositoryTools(runtime) {
|
|
|
30986
31059
|
// src/tool-packs/github/workspace.ts
|
|
30987
31060
|
import { randomUUID as randomUUID8 } from "node:crypto";
|
|
30988
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";
|
|
30989
|
-
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";
|
|
30990
31063
|
var SAFE_LOCAL_ID = /^[A-Za-z0-9_-]{1,200}$/;
|
|
30991
31064
|
var FULL_NAME2 = /^[A-Za-z0-9_.-]{1,100}\/[A-Za-z0-9_.-]{1,100}$/;
|
|
30992
31065
|
var DIRECTORY_MODE2 = 448;
|
|
@@ -31009,7 +31082,7 @@ function assertBelow2(parent, child, label) {
|
|
|
31009
31082
|
}
|
|
31010
31083
|
}
|
|
31011
31084
|
function samePath(left, right) {
|
|
31012
|
-
return process.platform === "win32" ?
|
|
31085
|
+
return process.platform === "win32" ? resolve7(left).toLowerCase() === resolve7(right).toLowerCase() : resolve7(left) === resolve7(right);
|
|
31013
31086
|
}
|
|
31014
31087
|
async function requireRealDirectory2(path, label) {
|
|
31015
31088
|
const entry = await lstat8(path).catch(() => null);
|
|
@@ -32826,8 +32899,8 @@ var linearToolPackFactory = {
|
|
|
32826
32899
|
async create(grant, context) {
|
|
32827
32900
|
let resolveCancelled;
|
|
32828
32901
|
let closed = false;
|
|
32829
|
-
const cancelled = new Promise((
|
|
32830
|
-
resolveCancelled =
|
|
32902
|
+
const cancelled = new Promise((resolve17) => {
|
|
32903
|
+
resolveCancelled = resolve17;
|
|
32831
32904
|
});
|
|
32832
32905
|
const cancel = () => {
|
|
32833
32906
|
if (closed) return;
|
|
@@ -33627,7 +33700,7 @@ function createAskUserServer() {
|
|
|
33627
33700
|
let server;
|
|
33628
33701
|
let listening;
|
|
33629
33702
|
function ensureListening() {
|
|
33630
|
-
listening ??= new Promise((
|
|
33703
|
+
listening ??= new Promise((resolve17, reject3) => {
|
|
33631
33704
|
server = createServer2((req, res) => {
|
|
33632
33705
|
res.on("error", () => {
|
|
33633
33706
|
});
|
|
@@ -33643,7 +33716,7 @@ function createAskUserServer() {
|
|
|
33643
33716
|
server.on("error", reject3);
|
|
33644
33717
|
server.listen(0, "127.0.0.1", () => {
|
|
33645
33718
|
const address = server.address();
|
|
33646
|
-
if (address && typeof address === "object")
|
|
33719
|
+
if (address && typeof address === "object") resolve17(address.port);
|
|
33647
33720
|
else reject3(new Error("ask_user server failed to bind"));
|
|
33648
33721
|
});
|
|
33649
33722
|
server.unref();
|
|
@@ -34667,7 +34740,7 @@ password=${credential.accessToken}
|
|
|
34667
34740
|
|
|
34668
34741
|
// src/runners/working-context.ts
|
|
34669
34742
|
import { spawn as spawn6 } from "node:child_process";
|
|
34670
|
-
import { resolve as
|
|
34743
|
+
import { resolve as resolve8 } from "node:path";
|
|
34671
34744
|
var COMMAND_TIMEOUT_MS = 5e3;
|
|
34672
34745
|
var OUTPUT_LIMIT_BYTES = 128 * 1024;
|
|
34673
34746
|
var COMMAND_STOP_TIMEOUT_MS = 2e4;
|
|
@@ -35062,8 +35135,8 @@ async function repositoryState(directory, git, env, signal) {
|
|
|
35062
35135
|
const pathLines = paths.trim().split(/\r?\n/);
|
|
35063
35136
|
if (pathLines.length < 3 || !pathLines[0] || !pathLines[1] || !pathLines[2]) return null;
|
|
35064
35137
|
const root = pathLines[0];
|
|
35065
|
-
const gitDirectory =
|
|
35066
|
-
const commonDirectory =
|
|
35138
|
+
const gitDirectory = resolve8(directory, pathLines[1]);
|
|
35139
|
+
const commonDirectory = resolve8(directory, pathLines[2]);
|
|
35067
35140
|
const records = status.split(/\0|\r?\n/).filter(Boolean);
|
|
35068
35141
|
const rawBranch = statusField(records, "branch.head");
|
|
35069
35142
|
if (!rawBranch || rawBranch.length > 512 || !isSafeSingleLineDisplayText(rawBranch)) return null;
|
|
@@ -35228,8 +35301,8 @@ import {
|
|
|
35228
35301
|
rm as rm7,
|
|
35229
35302
|
writeFile as writeFile5
|
|
35230
35303
|
} from "node:fs/promises";
|
|
35231
|
-
import { homedir as
|
|
35232
|
-
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";
|
|
35233
35306
|
var SAFE_SEGMENT2 = /^[A-Za-z0-9_-]{1,200}$/;
|
|
35234
35307
|
var DIRECTORY_MODE4 = 448;
|
|
35235
35308
|
var FILE_MODE3 = 384;
|
|
@@ -35446,7 +35519,7 @@ foreach ($path in $paths) {
|
|
|
35446
35519
|
}
|
|
35447
35520
|
`;
|
|
35448
35521
|
function defaultRunArtifactRoot() {
|
|
35449
|
-
return join13(
|
|
35522
|
+
return join13(homedir4(), ".zixt", "run-artifacts");
|
|
35450
35523
|
}
|
|
35451
35524
|
function requireSafeSegment(value, field) {
|
|
35452
35525
|
if (!SAFE_SEGMENT2.test(value)) {
|
|
@@ -35490,10 +35563,10 @@ async function rejectWindowsSymlinkAncestors(profile, target) {
|
|
|
35490
35563
|
}
|
|
35491
35564
|
}
|
|
35492
35565
|
async function prepareRoot(root) {
|
|
35493
|
-
const absolute =
|
|
35566
|
+
const absolute = resolve9(root);
|
|
35494
35567
|
let realProfile;
|
|
35495
35568
|
if (process.platform === "win32") {
|
|
35496
|
-
const profile =
|
|
35569
|
+
const profile = resolve9(homedir4());
|
|
35497
35570
|
assertWindowsProfileBoundary(profile, absolute);
|
|
35498
35571
|
await rejectWindowsSymlinkAncestors(profile, absolute);
|
|
35499
35572
|
realProfile = await realpath7(profile);
|
|
@@ -35663,10 +35736,10 @@ async function removePrivateTreeWithRetries(path, removeTree, retryDelayMs) {
|
|
|
35663
35736
|
}
|
|
35664
35737
|
}
|
|
35665
35738
|
async function sweepOrphanedRunArtifacts(root) {
|
|
35666
|
-
const absolute =
|
|
35739
|
+
const absolute = resolve9(root);
|
|
35667
35740
|
let realProfile;
|
|
35668
35741
|
if (process.platform === "win32") {
|
|
35669
|
-
const profile =
|
|
35742
|
+
const profile = resolve9(homedir4());
|
|
35670
35743
|
assertWindowsProfileBoundary(profile, absolute);
|
|
35671
35744
|
await rejectWindowsSymlinkAncestors(profile, absolute);
|
|
35672
35745
|
realProfile = await realpath7(profile);
|
|
@@ -35698,7 +35771,7 @@ async function sweepOrphanedRunArtifacts(root) {
|
|
|
35698
35771
|
return removed;
|
|
35699
35772
|
}
|
|
35700
35773
|
function defaultRunRegistryRoot() {
|
|
35701
|
-
return join13(
|
|
35774
|
+
return join13(homedir4(), ".zixt", "run-registry");
|
|
35702
35775
|
}
|
|
35703
35776
|
async function syncRunRegistryDirectory(path) {
|
|
35704
35777
|
const handle = await open5(path, "r");
|
|
@@ -35711,9 +35784,9 @@ async function syncRunRegistryDirectory(path) {
|
|
|
35711
35784
|
async function ensureDurableRunRegistryRoot(registryRoot, syncDirectory7) {
|
|
35712
35785
|
const firstCreated = await mkdir9(registryRoot, { recursive: true, mode: DIRECTORY_MODE4 });
|
|
35713
35786
|
if (firstCreated && process.platform !== "win32") {
|
|
35714
|
-
const first =
|
|
35715
|
-
const target =
|
|
35716
|
-
await syncDirectory7(
|
|
35787
|
+
const first = resolve9(firstCreated);
|
|
35788
|
+
const target = resolve9(registryRoot);
|
|
35789
|
+
await syncDirectory7(dirname7(first));
|
|
35717
35790
|
let current = first;
|
|
35718
35791
|
for (const part of relative8(first, target).split(sep4).filter(Boolean)) {
|
|
35719
35792
|
await syncDirectory7(current);
|
|
@@ -35888,7 +35961,7 @@ async function settlesWithin(promise2, timeoutMs) {
|
|
|
35888
35961
|
}
|
|
35889
35962
|
}
|
|
35890
35963
|
function defaultRunnerWorkspaceRoot() {
|
|
35891
|
-
return join14(
|
|
35964
|
+
return join14(homedir5(), ".zixt", "workspaces");
|
|
35892
35965
|
}
|
|
35893
35966
|
function defaultRunnerArtifactRoot() {
|
|
35894
35967
|
return defaultRunArtifactRoot();
|
|
@@ -35948,7 +36021,7 @@ function createCliRunner(adapter, opts = {}) {
|
|
|
35948
36021
|
const prefixArgs = opts.commandPrefixArgs ?? [];
|
|
35949
36022
|
const maxWallTimeMs = opts.maxWallTimeMs;
|
|
35950
36023
|
const workspaceRoot = opts.workspaceRoot ?? defaultRunnerWorkspaceRoot();
|
|
35951
|
-
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"));
|
|
35952
36025
|
const runRegistryRoot2 = opts.runRegistryRoot ?? defaultRunRegistryRoot();
|
|
35953
36026
|
const createArtifacts = opts.createArtifacts ?? createRunArtifacts;
|
|
35954
36027
|
const toolPackRegistry2 = opts.toolPackRegistry ?? createDefaultToolPackRegistry();
|
|
@@ -36033,7 +36106,7 @@ function createCliRunner(adapter, opts = {}) {
|
|
|
36033
36106
|
outcome.ok && outcome.result && typeof outcome.result === "object" ? outcome.result["artifact"] : void 0
|
|
36034
36107
|
);
|
|
36035
36108
|
if (parsed.success) {
|
|
36036
|
-
const candidate =
|
|
36109
|
+
const candidate = resolve10(cwd, path);
|
|
36037
36110
|
const key = await realpath8(candidate).catch(() => candidate);
|
|
36038
36111
|
publishedTaskFiles.set(key, parsed.data);
|
|
36039
36112
|
}
|
|
@@ -36314,8 +36387,8 @@ ${attachmentSection}` : prompt;
|
|
|
36314
36387
|
let changed = false;
|
|
36315
36388
|
for (const path of paths) {
|
|
36316
36389
|
if (!path || path.length > 4096) continue;
|
|
36317
|
-
const absolutePath = isAbsolute14(path) ? path :
|
|
36318
|
-
const directory =
|
|
36390
|
+
const absolutePath = isAbsolute14(path) ? path : resolve10(cwd, path);
|
|
36391
|
+
const directory = dirname8(absolutePath);
|
|
36319
36392
|
observedWorkingDirectories.delete(directory);
|
|
36320
36393
|
observedWorkingDirectories.add(directory);
|
|
36321
36394
|
while (observedWorkingDirectories.size > 19) {
|
|
@@ -36747,7 +36820,7 @@ function runCliProcess(options) {
|
|
|
36747
36820
|
usage: { inputTokens: 0, outputTokens: 0 }
|
|
36748
36821
|
});
|
|
36749
36822
|
}
|
|
36750
|
-
return new Promise((
|
|
36823
|
+
return new Promise((resolve17) => {
|
|
36751
36824
|
const platform = options.platform ?? process.platform;
|
|
36752
36825
|
const containmentGateNonce = options.guardian && platform === "win32" ? randomUUID10() : void 0;
|
|
36753
36826
|
const child = options.guardian ? spawn8(
|
|
@@ -36761,7 +36834,7 @@ function runCliProcess(options) {
|
|
|
36761
36834
|
// The idle pre-assignment guardian must never load from or depend
|
|
36762
36835
|
// on an untrusted Task checkout. Only the post-gate target enters
|
|
36763
36836
|
// the requested working directory from its private release frame.
|
|
36764
|
-
cwd:
|
|
36837
|
+
cwd: dirname8(options.guardian.scriptPath),
|
|
36765
36838
|
env: runnerGuardianEnv(process.env, containmentGateNonce),
|
|
36766
36839
|
stdio: ["pipe", "pipe", "pipe"],
|
|
36767
36840
|
windowsHide: true,
|
|
@@ -36809,7 +36882,7 @@ function runCliProcess(options) {
|
|
|
36809
36882
|
clearInterval(timer);
|
|
36810
36883
|
unregisterFollowUps?.();
|
|
36811
36884
|
parser.stop?.();
|
|
36812
|
-
|
|
36885
|
+
resolve17(result);
|
|
36813
36886
|
};
|
|
36814
36887
|
const terminate = (result) => {
|
|
36815
36888
|
if (settled || forcedResult) return;
|
|
@@ -37042,13 +37115,13 @@ import { randomUUID as randomUUID11 } from "node:crypto";
|
|
|
37042
37115
|
|
|
37043
37116
|
// src/runners/runtime-observation.ts
|
|
37044
37117
|
import { open as open6, readdir as readdir4, realpath as realpath9 } from "node:fs/promises";
|
|
37045
|
-
import { homedir as
|
|
37118
|
+
import { homedir as homedir6 } from "node:os";
|
|
37046
37119
|
import { join as join15 } from "node:path";
|
|
37047
37120
|
var READ_WINDOW_BYTES = 1024 * 1024;
|
|
37048
37121
|
var CATALOG_TIMEOUT_MS = 15e3;
|
|
37049
37122
|
var CATALOG_OUTPUT_LIMIT_BYTES = 4 * 1024 * 1024;
|
|
37050
37123
|
function homeFrom(env) {
|
|
37051
|
-
return env["HOME"] || env["USERPROFILE"] ||
|
|
37124
|
+
return env["HOME"] || env["USERPROFILE"] || homedir6();
|
|
37052
37125
|
}
|
|
37053
37126
|
async function readHead(path) {
|
|
37054
37127
|
let handle;
|
|
@@ -37155,7 +37228,7 @@ async function readCodexSessionRuntime(input) {
|
|
|
37155
37228
|
}
|
|
37156
37229
|
var codexCatalogCache = /* @__PURE__ */ new Map();
|
|
37157
37230
|
async function loadCodexModelCatalog(command, prefixArgs, env) {
|
|
37158
|
-
const output = await new Promise((
|
|
37231
|
+
const output = await new Promise((resolve17) => {
|
|
37159
37232
|
const child = spawnCli(command, [...prefixArgs, "debug", "models"], {
|
|
37160
37233
|
stdio: ["ignore", "pipe", "ignore"],
|
|
37161
37234
|
windowsHide: true,
|
|
@@ -37170,7 +37243,7 @@ async function loadCodexModelCatalog(command, prefixArgs, env) {
|
|
|
37170
37243
|
if (settled) return;
|
|
37171
37244
|
settled = true;
|
|
37172
37245
|
clearTimeout(timer);
|
|
37173
|
-
|
|
37246
|
+
resolve17(value);
|
|
37174
37247
|
};
|
|
37175
37248
|
const timer = setTimeout(() => {
|
|
37176
37249
|
child.kill();
|
|
@@ -37275,8 +37348,8 @@ function createRuntimeReporter(input, sessionId) {
|
|
|
37275
37348
|
var EFFORT_READ_ATTEMPTS = 5;
|
|
37276
37349
|
var EFFORT_READ_INTERVAL_MS = 3e3;
|
|
37277
37350
|
function delay2(ms) {
|
|
37278
|
-
return new Promise((
|
|
37279
|
-
const timer = setTimeout(
|
|
37351
|
+
return new Promise((resolve17) => {
|
|
37352
|
+
const timer = setTimeout(resolve17, ms);
|
|
37280
37353
|
timer.unref?.();
|
|
37281
37354
|
});
|
|
37282
37355
|
}
|
|
@@ -37353,10 +37426,10 @@ function createClaudeLiveParser(onStream, onSessionModel) {
|
|
|
37353
37426
|
},
|
|
37354
37427
|
async steer(followUp) {
|
|
37355
37428
|
if (!write) return false;
|
|
37356
|
-
return await new Promise((
|
|
37357
|
-
acknowledgements.set(followUp.inputId,
|
|
37429
|
+
return await new Promise((resolve17) => {
|
|
37430
|
+
acknowledgements.set(followUp.inputId, resolve17);
|
|
37358
37431
|
void write(input(followUp.inputId, followUp.text)).catch(() => {
|
|
37359
|
-
if (acknowledgements.delete(followUp.inputId))
|
|
37432
|
+
if (acknowledgements.delete(followUp.inputId)) resolve17(false);
|
|
37360
37433
|
});
|
|
37361
37434
|
});
|
|
37362
37435
|
},
|
|
@@ -37518,11 +37591,11 @@ function improveErrorMessage(error52) {
|
|
|
37518
37591
|
// src/runners/codex.ts
|
|
37519
37592
|
import { mkdir as mkdir11, readFile as readFile9, writeFile as writeFile6 } from "node:fs/promises";
|
|
37520
37593
|
import { randomUUID as randomUUID12 } from "node:crypto";
|
|
37521
|
-
import { homedir as
|
|
37594
|
+
import { homedir as homedir7 } from "node:os";
|
|
37522
37595
|
import { join as join16 } from "node:path";
|
|
37523
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.";
|
|
37524
37597
|
function defaultCodexThreadIndexRoot() {
|
|
37525
|
-
return join16(
|
|
37598
|
+
return join16(homedir7(), ".zixt", "codex-threads");
|
|
37526
37599
|
}
|
|
37527
37600
|
var SAFE_SEGMENT3 = /^[A-Za-z0-9_-]{1,200}$/;
|
|
37528
37601
|
function threadIndexPath(root, agentId, sessionKey) {
|
|
@@ -37663,8 +37736,8 @@ ${value}` : value;
|
|
|
37663
37736
|
var RUNTIME_READ_ATTEMPTS = 5;
|
|
37664
37737
|
var RUNTIME_READ_INTERVAL_MS = 2e3;
|
|
37665
37738
|
function delay3(ms) {
|
|
37666
|
-
return new Promise((
|
|
37667
|
-
const timer = setTimeout(
|
|
37739
|
+
return new Promise((resolve17) => {
|
|
37740
|
+
const timer = setTimeout(resolve17, ms);
|
|
37668
37741
|
timer.unref?.();
|
|
37669
37742
|
});
|
|
37670
37743
|
}
|
|
@@ -37703,7 +37776,7 @@ function createCodexAppServerParser(onStream, options) {
|
|
|
37703
37776
|
const turnReadyWaiters = /* @__PURE__ */ new Set();
|
|
37704
37777
|
const usage = () => ({ inputTokens, outputTokens });
|
|
37705
37778
|
const settleTurnReadiness = (ready) => {
|
|
37706
|
-
for (const
|
|
37779
|
+
for (const resolve17 of turnReadyWaiters) resolve17(ready);
|
|
37707
37780
|
turnReadyWaiters.clear();
|
|
37708
37781
|
};
|
|
37709
37782
|
const send = async (message) => {
|
|
@@ -37884,12 +37957,12 @@ function createCodexAppServerParser(onStream, options) {
|
|
|
37884
37957
|
async steer(input) {
|
|
37885
37958
|
if (stopped) return false;
|
|
37886
37959
|
if (!activeTurnId) {
|
|
37887
|
-
const ready = await new Promise((
|
|
37960
|
+
const ready = await new Promise((resolve17) => turnReadyWaiters.add(resolve17));
|
|
37888
37961
|
if (!ready || stopped) return false;
|
|
37889
37962
|
}
|
|
37890
37963
|
if (!threadId || !activeTurnId) return false;
|
|
37891
|
-
return await new Promise((
|
|
37892
|
-
steerWaiters.set(input.inputId,
|
|
37964
|
+
return await new Promise((resolve17) => {
|
|
37965
|
+
steerWaiters.set(input.inputId, resolve17);
|
|
37893
37966
|
void send({
|
|
37894
37967
|
id: `steer:${input.inputId}`,
|
|
37895
37968
|
method: "turn/steer",
|
|
@@ -37900,7 +37973,7 @@ function createCodexAppServerParser(onStream, options) {
|
|
|
37900
37973
|
clientUserMessageId: input.inputId
|
|
37901
37974
|
}
|
|
37902
37975
|
}).catch(() => {
|
|
37903
|
-
if (steerWaiters.delete(input.inputId))
|
|
37976
|
+
if (steerWaiters.delete(input.inputId)) resolve17(false);
|
|
37904
37977
|
});
|
|
37905
37978
|
});
|
|
37906
37979
|
},
|
|
@@ -37908,7 +37981,7 @@ function createCodexAppServerParser(onStream, options) {
|
|
|
37908
37981
|
stopped = true;
|
|
37909
37982
|
write = null;
|
|
37910
37983
|
settleTurnReadiness(false);
|
|
37911
|
-
for (const
|
|
37984
|
+
for (const resolve17 of steerWaiters.values()) resolve17(false);
|
|
37912
37985
|
steerWaiters.clear();
|
|
37913
37986
|
},
|
|
37914
37987
|
push(chunk) {
|
|
@@ -38087,7 +38160,7 @@ function improveCodexErrorMessage(error52) {
|
|
|
38087
38160
|
// src/runners/git-preflight.ts
|
|
38088
38161
|
import { spawn as spawn9 } from "node:child_process";
|
|
38089
38162
|
import { realpath as realpath10 } from "node:fs/promises";
|
|
38090
|
-
import { isAbsolute as isAbsolute15, resolve as
|
|
38163
|
+
import { isAbsolute as isAbsolute15, resolve as resolve11 } from "node:path";
|
|
38091
38164
|
var OUTPUT_LIMIT = 8192;
|
|
38092
38165
|
var DEFAULT_TIMEOUT_MS4 = 1e4;
|
|
38093
38166
|
var VERSION_PATTERN = /^git version [^\r\n]{1,108}$/;
|
|
@@ -38106,7 +38179,7 @@ async function preflightGit(options = {}) {
|
|
|
38106
38179
|
if (configured !== void 0 && !isAbsolute15(configured)) {
|
|
38107
38180
|
return unavailable("configured git command must be an absolute file", checkedAt);
|
|
38108
38181
|
}
|
|
38109
|
-
const trustedCwd = await realpath10(
|
|
38182
|
+
const trustedCwd = await realpath10(resolve11(options.trustedCwd ?? process.cwd())).catch(() => null);
|
|
38110
38183
|
if (!trustedCwd)
|
|
38111
38184
|
return unavailable("Host-owned git preflight directory is unavailable", checkedAt);
|
|
38112
38185
|
const executablePath = await resolveTrustedCliCommand(configured ?? "git", {
|
|
@@ -38328,7 +38401,7 @@ function parseAuth(result) {
|
|
|
38328
38401
|
return "unknown";
|
|
38329
38402
|
}
|
|
38330
38403
|
function run2(command, args) {
|
|
38331
|
-
return new Promise((
|
|
38404
|
+
return new Promise((resolve17) => {
|
|
38332
38405
|
const child = spawnCli(command, args, {
|
|
38333
38406
|
stdio: ["ignore", "pipe", "pipe"],
|
|
38334
38407
|
windowsHide: true
|
|
@@ -38344,7 +38417,7 @@ function run2(command, args) {
|
|
|
38344
38417
|
if (settled) return;
|
|
38345
38418
|
settled = true;
|
|
38346
38419
|
clearTimeout(timeout);
|
|
38347
|
-
|
|
38420
|
+
resolve17(result);
|
|
38348
38421
|
};
|
|
38349
38422
|
const timeout = setTimeout(() => {
|
|
38350
38423
|
child.kill();
|
|
@@ -38359,8 +38432,8 @@ function run2(command, args) {
|
|
|
38359
38432
|
import { spawn as spawn10 } from "node:child_process";
|
|
38360
38433
|
import { constants as constants2 } from "node:fs";
|
|
38361
38434
|
import { access as access4, chmod as chmod7, mkdir as mkdir12, open as open7, rename as rename6, rm as rm8 } from "node:fs/promises";
|
|
38362
|
-
import { homedir as
|
|
38363
|
-
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";
|
|
38364
38437
|
var SERVICE_NAME = "zixt-host.service";
|
|
38365
38438
|
var SYSTEM_SERVICE_COMMAND_TIMEOUT_MS = 7e4;
|
|
38366
38439
|
var SERVICE_STABILITY_DELAY_MS = 2e3;
|
|
@@ -38388,7 +38461,7 @@ function boundedAppend(current, chunk) {
|
|
|
38388
38461
|
}
|
|
38389
38462
|
async function defaultRunCommand(command, args) {
|
|
38390
38463
|
const commandEnvironment3 = systemServiceCommandEnvironment();
|
|
38391
|
-
return new Promise((
|
|
38464
|
+
return new Promise((resolve17) => {
|
|
38392
38465
|
const child = spawn10(command, [...args], {
|
|
38393
38466
|
stdio: ["ignore", "pipe", "pipe"],
|
|
38394
38467
|
env: commandEnvironment3,
|
|
@@ -38402,7 +38475,7 @@ async function defaultRunCommand(command, args) {
|
|
|
38402
38475
|
if (settled) return;
|
|
38403
38476
|
settled = true;
|
|
38404
38477
|
if (timer) clearTimeout(timer);
|
|
38405
|
-
|
|
38478
|
+
resolve17(result);
|
|
38406
38479
|
};
|
|
38407
38480
|
child.stdout?.on("data", (chunk) => {
|
|
38408
38481
|
stdout = boundedAppend(stdout, chunk);
|
|
@@ -38463,9 +38536,9 @@ async function defaultSyncDirectory(path) {
|
|
|
38463
38536
|
async function ensureDirectory(path, mode, syncDirectory7) {
|
|
38464
38537
|
const firstCreated = await mkdir12(path, { recursive: true, mode });
|
|
38465
38538
|
if (!firstCreated) return;
|
|
38466
|
-
const first =
|
|
38467
|
-
const target =
|
|
38468
|
-
await syncDirectory7(
|
|
38539
|
+
const first = resolve12(firstCreated);
|
|
38540
|
+
const target = resolve12(path);
|
|
38541
|
+
await syncDirectory7(dirname9(first));
|
|
38469
38542
|
let current = first;
|
|
38470
38543
|
const descendants = relative9(first, target);
|
|
38471
38544
|
for (const part of descendants ? descendants.split(sep5) : []) {
|
|
@@ -38474,7 +38547,7 @@ async function ensureDirectory(path, mode, syncDirectory7) {
|
|
|
38474
38547
|
}
|
|
38475
38548
|
}
|
|
38476
38549
|
async function replacePrivateFile(path, contents, mode, syncDirectory7) {
|
|
38477
|
-
const parent =
|
|
38550
|
+
const parent = dirname9(path);
|
|
38478
38551
|
await ensureDirectory(parent, 448, syncDirectory7);
|
|
38479
38552
|
const temporary = join17(parent, `.${basename4(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
|
|
38480
38553
|
const handle = await open7(temporary, "wx", mode);
|
|
@@ -38520,7 +38593,7 @@ async function installLinuxService(options) {
|
|
|
38520
38593
|
throw new Error("Linux automatic startup is available only on Linux.");
|
|
38521
38594
|
}
|
|
38522
38595
|
const env = options.env ?? process.env;
|
|
38523
|
-
const home = options.home ??
|
|
38596
|
+
const home = options.home ?? homedir8();
|
|
38524
38597
|
const username = oneLine(options.username ?? userInfo().username, "user name");
|
|
38525
38598
|
const token2 = oneLine(options.token, "pairing code");
|
|
38526
38599
|
const path = oneLine(
|
|
@@ -38538,7 +38611,7 @@ async function installLinuxService(options) {
|
|
|
38538
38611
|
const resolveCommand = options.resolveCommand ?? defaultResolveCommand;
|
|
38539
38612
|
const run3 = options.runCommand ?? defaultRunCommand;
|
|
38540
38613
|
const syncDirectory7 = options.syncDirectory ?? defaultSyncDirectory;
|
|
38541
|
-
const stabilityDelay = options.delay ?? ((ms) => new Promise((
|
|
38614
|
+
const stabilityDelay = options.delay ?? ((ms) => new Promise((resolve17) => setTimeout(resolve17, ms)));
|
|
38542
38615
|
const [systemctl, loginctl] = await Promise.all([
|
|
38543
38616
|
resolveCommand("systemctl"),
|
|
38544
38617
|
resolveCommand("loginctl")
|
|
@@ -38652,8 +38725,8 @@ async function installLinuxService(options) {
|
|
|
38652
38725
|
import { spawn as spawn11 } from "node:child_process";
|
|
38653
38726
|
import { constants as constants3 } from "node:fs";
|
|
38654
38727
|
import { access as access5, chmod as chmod8, mkdir as mkdir13, open as open8, rename as rename7, rm as rm9 } from "node:fs/promises";
|
|
38655
|
-
import { homedir as
|
|
38656
|
-
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";
|
|
38657
38730
|
var LAUNCH_AGENT_LABEL = "ai.zixt.host";
|
|
38658
38731
|
var SERVICE_STABILITY_DELAY_MS2 = 2e3;
|
|
38659
38732
|
var COMMAND_TIMEOUT_MS2 = 7e4;
|
|
@@ -38679,9 +38752,9 @@ async function syncDirectory4(path) {
|
|
|
38679
38752
|
async function ensureDirectory2(path, sync) {
|
|
38680
38753
|
const firstCreated = await mkdir13(path, { recursive: true, mode: 448 });
|
|
38681
38754
|
if (!firstCreated) return;
|
|
38682
|
-
const first =
|
|
38683
|
-
const target =
|
|
38684
|
-
await sync(
|
|
38755
|
+
const first = resolve13(firstCreated);
|
|
38756
|
+
const target = resolve13(path);
|
|
38757
|
+
await sync(dirname10(first));
|
|
38685
38758
|
let current = first;
|
|
38686
38759
|
for (const part of relative10(first, target).split(sep6).filter(Boolean)) {
|
|
38687
38760
|
await sync(current);
|
|
@@ -38689,7 +38762,7 @@ async function ensureDirectory2(path, sync) {
|
|
|
38689
38762
|
}
|
|
38690
38763
|
}
|
|
38691
38764
|
async function replacePrivateFile2(path, contents, mode, sync) {
|
|
38692
|
-
const parent =
|
|
38765
|
+
const parent = dirname10(path);
|
|
38693
38766
|
await ensureDirectory2(parent, sync);
|
|
38694
38767
|
const temporary = join18(parent, `.${basename5(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
|
|
38695
38768
|
const handle = await open8(temporary, "wx", mode);
|
|
@@ -38779,7 +38852,7 @@ async function installMacosService(options) {
|
|
|
38779
38852
|
throw new Error("macOS automatic startup is available only on macOS.");
|
|
38780
38853
|
}
|
|
38781
38854
|
const env = options.env ?? process.env;
|
|
38782
|
-
const home = options.home ??
|
|
38855
|
+
const home = options.home ?? homedir9();
|
|
38783
38856
|
const uid = options.uid ?? userInfo2().uid;
|
|
38784
38857
|
if (!Number.isSafeInteger(uid) || uid < 0) throw new Error("macOS user id is invalid.");
|
|
38785
38858
|
const token2 = oneLine2(options.token, "pairing code");
|
|
@@ -38883,8 +38956,8 @@ async function installMacosService(options) {
|
|
|
38883
38956
|
import { spawn as spawn12 } from "node:child_process";
|
|
38884
38957
|
import { constants as constants4 } from "node:fs";
|
|
38885
38958
|
import { access as access6, mkdir as mkdir14, open as open9, readFile as readFile10, rename as rename8, rm as rm10 } from "node:fs/promises";
|
|
38886
|
-
import { homedir as
|
|
38887
|
-
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";
|
|
38888
38961
|
var TASK_NAME = "Zixt Host";
|
|
38889
38962
|
var COMMAND_TIMEOUT_MS3 = 7e4;
|
|
38890
38963
|
var SERVICE_STABILITY_DELAY_MS3 = 2e3;
|
|
@@ -38912,9 +38985,9 @@ async function syncDirectory5(path) {
|
|
|
38912
38985
|
async function ensureDirectory3(path, sync) {
|
|
38913
38986
|
const firstCreated = await mkdir14(path, { recursive: true, mode: 448 });
|
|
38914
38987
|
if (!firstCreated) return;
|
|
38915
|
-
const first =
|
|
38916
|
-
const target =
|
|
38917
|
-
await sync(
|
|
38988
|
+
const first = resolve14(firstCreated);
|
|
38989
|
+
const target = resolve14(path);
|
|
38990
|
+
await sync(dirname11(first));
|
|
38918
38991
|
let current = first;
|
|
38919
38992
|
for (const part of relative11(first, target).split(sep7).filter(Boolean)) {
|
|
38920
38993
|
await sync(current);
|
|
@@ -38922,7 +38995,7 @@ async function ensureDirectory3(path, sync) {
|
|
|
38922
38995
|
}
|
|
38923
38996
|
}
|
|
38924
38997
|
async function replacePrivateFile3(path, contents, sync) {
|
|
38925
|
-
const parent =
|
|
38998
|
+
const parent = dirname11(path);
|
|
38926
38999
|
await ensureDirectory3(parent, sync);
|
|
38927
39000
|
const temporary = join19(parent, `.${basename6(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
|
|
38928
39001
|
const handle = await open9(temporary, "wx", 384);
|
|
@@ -39108,7 +39181,7 @@ async function installWindowsService(options) {
|
|
|
39108
39181
|
throw new Error("Windows automatic startup is available only on Windows.");
|
|
39109
39182
|
}
|
|
39110
39183
|
const env = options.env ?? process.env;
|
|
39111
|
-
const home = options.home ??
|
|
39184
|
+
const home = options.home ?? homedir10();
|
|
39112
39185
|
const localAppData = options.localAppData ?? env.LOCALAPPDATA;
|
|
39113
39186
|
if (!localAppData || !isAbsolute16(localAppData)) {
|
|
39114
39187
|
throw new Error("Windows local application data path is unavailable.");
|
|
@@ -39222,15 +39295,15 @@ async function installSystemService(options) {
|
|
|
39222
39295
|
|
|
39223
39296
|
// src/terminal-outcomes.ts
|
|
39224
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";
|
|
39225
|
-
import { homedir as
|
|
39226
|
-
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";
|
|
39227
39300
|
var DIRECTORY_MODE5 = 448;
|
|
39228
39301
|
var FILE_MODE4 = 384;
|
|
39229
39302
|
var MAX_OUTCOME_BYTES = 4 * 1024 * 1024;
|
|
39230
39303
|
var HOST_DIRECTORY = /^hst_[0-9a-f]{32}$/;
|
|
39231
39304
|
var OUTCOME_FILE = /^(tsk_[0-9a-f]{32})\.([1-9][0-9]*)\.json$/;
|
|
39232
39305
|
function defaultTerminalOutcomeRoot() {
|
|
39233
|
-
return join20(
|
|
39306
|
+
return join20(homedir11(), ".zixt", "terminal-outcomes");
|
|
39234
39307
|
}
|
|
39235
39308
|
function hostOutcomeRoot(root, hostId) {
|
|
39236
39309
|
if (!HOST_DIRECTORY.test(hostId)) throw new Error("terminal outcome Host identity is malformed");
|
|
@@ -39251,9 +39324,9 @@ async function syncDirectory6(root) {
|
|
|
39251
39324
|
async function requirePrivateRoot(root, sync = syncDirectory6) {
|
|
39252
39325
|
const firstCreated = await mkdir15(root, { recursive: true, mode: DIRECTORY_MODE5 });
|
|
39253
39326
|
if (firstCreated) {
|
|
39254
|
-
const first =
|
|
39255
|
-
const target =
|
|
39256
|
-
await sync(
|
|
39327
|
+
const first = resolve15(firstCreated);
|
|
39328
|
+
const target = resolve15(root);
|
|
39329
|
+
await sync(dirname12(first));
|
|
39257
39330
|
let current = first;
|
|
39258
39331
|
for (const part of relative12(first, target).split(sep8).filter(Boolean)) {
|
|
39259
39332
|
await sync(current);
|
|
@@ -39503,12 +39576,12 @@ function createHostLogger(options = {}) {
|
|
|
39503
39576
|
}
|
|
39504
39577
|
|
|
39505
39578
|
// src/demo-state.ts
|
|
39506
|
-
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";
|
|
39507
39580
|
var DEMO_STATE_ROOT_ENV = "ZIXT_DEMO_STATE_ROOT";
|
|
39508
39581
|
function resolveDemoHostStatePaths(env = process.env) {
|
|
39509
39582
|
const configured = env.ZIXT_RUNNER === "demo" ? env[DEMO_STATE_ROOT_ENV] : void 0;
|
|
39510
39583
|
if (!configured) return null;
|
|
39511
|
-
const root =
|
|
39584
|
+
const root = resolve16(configured);
|
|
39512
39585
|
if (!isAbsolute17(configured) || root === parse3(root).root) {
|
|
39513
39586
|
throw new Error(`${DEMO_STATE_ROOT_ENV} must be a dedicated absolute directory`);
|
|
39514
39587
|
}
|
|
@@ -39926,6 +39999,10 @@ async function telemetry() {
|
|
|
39926
39999
|
runners: cachedRunners ?? [],
|
|
39927
40000
|
workspaces: [],
|
|
39928
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()),
|
|
39929
40006
|
capabilities: {
|
|
39930
40007
|
linearToolPack: providerToolPacks.some(
|
|
39931
40008
|
(pack) => pack.provider === "linear" && pack.health === "ready"
|