@zixt/host 0.0.69 → 0.0.71
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 +458 -371
- 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.71",
|
|
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
|
/**
|
|
@@ -15518,7 +15537,9 @@ var HostTelemetry = external_exports.object({
|
|
|
15518
15537
|
/** Streams the bounded local Host terminal tail to Admin/Owner Machine diagnostics. */
|
|
15519
15538
|
hostConsole: external_exports.literal(true).optional(),
|
|
15520
15539
|
/** Accepts an authenticated, Admin/Owner-triggered immediate package refresh. */
|
|
15521
|
-
remoteUpdate: external_exports.literal(true).optional()
|
|
15540
|
+
remoteUpdate: external_exports.literal(true).optional(),
|
|
15541
|
+
/** How this installation receives Zixt Host code. */
|
|
15542
|
+
hostUpdateMode: external_exports.enum(["published", "source", "pinned"]).optional()
|
|
15522
15543
|
}).optional()
|
|
15523
15544
|
});
|
|
15524
15545
|
var HostConnectionIssue = external_exports.discriminatedUnion("code", [
|
|
@@ -18427,7 +18448,8 @@ var ManagerTaskRailWorkstream = external_exports.object({
|
|
|
18427
18448
|
workstreamId: external_exports.string().min(1).max(160),
|
|
18428
18449
|
/** The workstream's newest live Task title, already role-projected. */
|
|
18429
18450
|
title: external_exports.string().max(1e3),
|
|
18430
|
-
representative: ManagerTaskRailRepresentative
|
|
18451
|
+
representative: ManagerTaskRailRepresentative,
|
|
18452
|
+
browserAttention: external_exports.boolean().default(false)
|
|
18431
18453
|
}).strict();
|
|
18432
18454
|
var ManagerTaskRailSummary = external_exports.object({
|
|
18433
18455
|
conversationId: ConversationId,
|
|
@@ -18435,6 +18457,7 @@ var ManagerTaskRailSummary = external_exports.object({
|
|
|
18435
18457
|
hasAgentMatch: external_exports.boolean(),
|
|
18436
18458
|
hasStatusMatch: external_exports.boolean(),
|
|
18437
18459
|
representative: ManagerTaskRailRepresentative.nullable(),
|
|
18460
|
+
browserAttention: external_exports.boolean().default(false),
|
|
18438
18461
|
/**
|
|
18439
18462
|
* Live workstreams this thread carries besides the one its own row
|
|
18440
18463
|
* represents. Defaulted so a browser that outruns a deploy degrades to the
|
|
@@ -18473,6 +18496,186 @@ var ManagerStreamFrame = external_exports.discriminatedUnion("type", [
|
|
|
18473
18496
|
external_exports.object({ type: external_exports.literal("conversation"), conversation: ConversationProjection }).strict()
|
|
18474
18497
|
]);
|
|
18475
18498
|
|
|
18499
|
+
// ../../packages/contracts/src/platform.ts
|
|
18500
|
+
var JournalEntry = external_exports.object({
|
|
18501
|
+
id: external_exports.string(),
|
|
18502
|
+
agentId: AgentId,
|
|
18503
|
+
/** auto = task/comm lifecycle; note = agent-written. */
|
|
18504
|
+
kind: external_exports.enum(["auto", "note"]),
|
|
18505
|
+
text: external_exports.string().min(1).max(1e4),
|
|
18506
|
+
at: IsoDate2
|
|
18507
|
+
});
|
|
18508
|
+
var MemoryEntry = external_exports.object({
|
|
18509
|
+
id: external_exports.string(),
|
|
18510
|
+
agentId: AgentId,
|
|
18511
|
+
/** Machine display name; null = true everywhere (global). */
|
|
18512
|
+
machine: external_exports.string().nullable(),
|
|
18513
|
+
kind: external_exports.enum(["fact", "preference", "lesson", "context", "correction", "project", "environment"]),
|
|
18514
|
+
/** TS-10: written during an external-origin run; render as untrusted data. */
|
|
18515
|
+
trust: external_exports.enum(["internal", "external"]),
|
|
18516
|
+
text: external_exports.string().min(1).max(2e3),
|
|
18517
|
+
updatedAt: IsoDate2
|
|
18518
|
+
});
|
|
18519
|
+
var JournalResponse = external_exports.object({
|
|
18520
|
+
/** Bounded current-state summary (compaction target). */
|
|
18521
|
+
summary: external_exports.string(),
|
|
18522
|
+
entries: external_exports.array(JournalEntry),
|
|
18523
|
+
/** Curated memory, newest first. Absent only from pre-memory clients' view. */
|
|
18524
|
+
memories: external_exports.array(MemoryEntry).default([])
|
|
18525
|
+
});
|
|
18526
|
+
var AuditRecord = external_exports.object({
|
|
18527
|
+
id: external_exports.string(),
|
|
18528
|
+
/** member:<id>, agent:<id>, host:<id>, or system. */
|
|
18529
|
+
actor: external_exports.string(),
|
|
18530
|
+
action: external_exports.string(),
|
|
18531
|
+
/** Prefixed id of the acted-on resource. */
|
|
18532
|
+
target: external_exports.string(),
|
|
18533
|
+
summary: external_exports.string().max(2e3),
|
|
18534
|
+
/** Exact machine-readable deltas when the event changes configuration. */
|
|
18535
|
+
changes: external_exports.object({
|
|
18536
|
+
connectionAccess: external_exports.object({ before: ConnectionAccess, after: ConnectionAccess }).optional(),
|
|
18537
|
+
requiredConnectionIds: external_exports.object({
|
|
18538
|
+
before: external_exports.array(ConnectionId).max(100),
|
|
18539
|
+
after: external_exports.array(ConnectionId).max(100)
|
|
18540
|
+
}).optional(),
|
|
18541
|
+
integrationSettings: external_exports.object({ before: IntegrationSettings, after: IntegrationSettings }).optional()
|
|
18542
|
+
}).strict().optional(),
|
|
18543
|
+
at: IsoDate2
|
|
18544
|
+
});
|
|
18545
|
+
var ListAuditResponse = external_exports.object({ records: external_exports.array(AuditRecord) });
|
|
18546
|
+
var SecretScope = external_exports.enum(["org", "agent"]);
|
|
18547
|
+
var SecretKind = external_exports.enum(["env", "web_login"]);
|
|
18548
|
+
var SecretMeta = external_exports.object({
|
|
18549
|
+
name: external_exports.string().min(1).max(120).regex(/^[A-Z][A-Z0-9_]*$/, "UPPER_SNAKE_CASE env var name"),
|
|
18550
|
+
/** Absent on legacy rows/clients means `env`. */
|
|
18551
|
+
kind: SecretKind.default("env"),
|
|
18552
|
+
scope: SecretScope,
|
|
18553
|
+
/** Canonical availability set for teammate-scoped credentials. */
|
|
18554
|
+
agentIds: external_exports.array(AgentId).min(1).nullable().default(null),
|
|
18555
|
+
/** Legacy single-teammate projection, retained while older clients migrate. */
|
|
18556
|
+
agentId: AgentId.nullable(),
|
|
18557
|
+
/**
|
|
18558
|
+
* What this credential is for — rendered into the agent's system prompt
|
|
18559
|
+
* (names and descriptions only, never values) so the agent knows what it
|
|
18560
|
+
* holds and when to reach for it.
|
|
18561
|
+
*/
|
|
18562
|
+
description: external_exports.string().max(500).optional(),
|
|
18563
|
+
/** web_login metadata (admin projection only; never the password). */
|
|
18564
|
+
webLogin: external_exports.object({ loginUrl: external_exports.url().max(2e3), username: external_exports.string().min(1).max(500) }).strict().optional(),
|
|
18565
|
+
updatedAt: IsoDate2
|
|
18566
|
+
});
|
|
18567
|
+
var PutSecretFields = {
|
|
18568
|
+
name: SecretMeta.shape.name,
|
|
18569
|
+
kind: SecretKind.default("env"),
|
|
18570
|
+
/** env kind: required single value. */
|
|
18571
|
+
value: external_exports.string().min(1).max(1e4).optional(),
|
|
18572
|
+
/** web_login kind: required structured value. */
|
|
18573
|
+
webLogin: WebLoginValue.optional(),
|
|
18574
|
+
description: external_exports.string().max(500).optional()
|
|
18575
|
+
};
|
|
18576
|
+
var requireKindMatchingValue = (request, ctx) => {
|
|
18577
|
+
if (request.kind === "env") {
|
|
18578
|
+
if (request.value === void 0)
|
|
18579
|
+
ctx.addIssue({ code: "custom", path: ["value"], message: "env credentials require a value" });
|
|
18580
|
+
if (request.webLogin !== void 0)
|
|
18581
|
+
ctx.addIssue({
|
|
18582
|
+
code: "custom",
|
|
18583
|
+
path: ["webLogin"],
|
|
18584
|
+
message: "env credentials must not carry a website login"
|
|
18585
|
+
});
|
|
18586
|
+
} else {
|
|
18587
|
+
if (request.webLogin === void 0)
|
|
18588
|
+
ctx.addIssue({
|
|
18589
|
+
code: "custom",
|
|
18590
|
+
path: ["webLogin"],
|
|
18591
|
+
message: "website logins require loginUrl, username, and password"
|
|
18592
|
+
});
|
|
18593
|
+
if (request.value !== void 0)
|
|
18594
|
+
ctx.addIssue({
|
|
18595
|
+
code: "custom",
|
|
18596
|
+
path: ["value"],
|
|
18597
|
+
message: "website logins must not carry a bare value"
|
|
18598
|
+
});
|
|
18599
|
+
}
|
|
18600
|
+
};
|
|
18601
|
+
var PutSecretRequest = external_exports.discriminatedUnion("scope", [
|
|
18602
|
+
external_exports.object({ ...PutSecretFields, scope: external_exports.literal("org") }).strict().superRefine(requireKindMatchingValue),
|
|
18603
|
+
external_exports.object({
|
|
18604
|
+
...PutSecretFields,
|
|
18605
|
+
scope: external_exports.literal("agent"),
|
|
18606
|
+
agentIds: external_exports.array(AgentId).min(1).max(100).optional(),
|
|
18607
|
+
agentId: AgentId.optional()
|
|
18608
|
+
}).strict().superRefine((request, ctx) => {
|
|
18609
|
+
if (request.agentIds === void 0 === (request.agentId === void 0)) {
|
|
18610
|
+
ctx.addIssue({
|
|
18611
|
+
code: "custom",
|
|
18612
|
+
path: ["agentIds"],
|
|
18613
|
+
message: "teammate credentials require exactly one of agentIds or legacy agentId"
|
|
18614
|
+
});
|
|
18615
|
+
}
|
|
18616
|
+
if (request.agentIds && new Set(request.agentIds).size !== request.agentIds.length) {
|
|
18617
|
+
ctx.addIssue({ code: "custom", path: ["agentIds"], message: "duplicate AI teammate" });
|
|
18618
|
+
}
|
|
18619
|
+
}).superRefine(requireKindMatchingValue)
|
|
18620
|
+
]);
|
|
18621
|
+
var AdminSecretsProjection = external_exports.object({
|
|
18622
|
+
metadataRedacted: external_exports.literal(false),
|
|
18623
|
+
secrets: external_exports.array(SecretMeta)
|
|
18624
|
+
}).strict();
|
|
18625
|
+
var MemberSecretsProjection = external_exports.object({
|
|
18626
|
+
metadataRedacted: external_exports.literal(true),
|
|
18627
|
+
configured: external_exports.boolean(),
|
|
18628
|
+
secrets: external_exports.tuple([])
|
|
18629
|
+
}).strict();
|
|
18630
|
+
var ListSecretsResponse = external_exports.discriminatedUnion("metadataRedacted", [
|
|
18631
|
+
AdminSecretsProjection,
|
|
18632
|
+
MemberSecretsProjection
|
|
18633
|
+
]);
|
|
18634
|
+
var Invite = external_exports.object({
|
|
18635
|
+
id: external_exports.string(),
|
|
18636
|
+
orgId: OrgId,
|
|
18637
|
+
email: external_exports.email(),
|
|
18638
|
+
role: OrgRole.exclude(["owner"]),
|
|
18639
|
+
acceptedAt: IsoDate2.nullable(),
|
|
18640
|
+
expiresAt: IsoDate2,
|
|
18641
|
+
revokedAt: IsoDate2.nullable(),
|
|
18642
|
+
createdAt: IsoDate2
|
|
18643
|
+
});
|
|
18644
|
+
var CreateInviteRequest = external_exports.object({
|
|
18645
|
+
email: external_exports.email(),
|
|
18646
|
+
role: OrgRole.exclude(["owner"]).default("member")
|
|
18647
|
+
});
|
|
18648
|
+
var CreateInviteResponse = external_exports.object({
|
|
18649
|
+
invite: Invite,
|
|
18650
|
+
/** One-time acceptance URL, also emailed when the deployment has SMTP. */
|
|
18651
|
+
acceptUrl: external_exports.url(),
|
|
18652
|
+
/** True when the invitation email was accepted by the mail server. */
|
|
18653
|
+
emailed: external_exports.boolean().default(false)
|
|
18654
|
+
});
|
|
18655
|
+
var ListInvitesResponse = external_exports.object({ invites: external_exports.array(Invite) });
|
|
18656
|
+
var UpdateMemberRoleRequest = external_exports.object({ role: OrgRole });
|
|
18657
|
+
var ConnectorKind = external_exports.enum([
|
|
18658
|
+
"github",
|
|
18659
|
+
"slack",
|
|
18660
|
+
"linear",
|
|
18661
|
+
"zendesk",
|
|
18662
|
+
"jira",
|
|
18663
|
+
"email",
|
|
18664
|
+
"mcp"
|
|
18665
|
+
]);
|
|
18666
|
+
var ConnectorCatalogEntry = external_exports.object({
|
|
18667
|
+
kind: ConnectorKind,
|
|
18668
|
+
name: external_exports.string(),
|
|
18669
|
+
description: external_exports.string(),
|
|
18670
|
+
status: external_exports.enum(["available", "coming_soon"])
|
|
18671
|
+
});
|
|
18672
|
+
var ConnectionsCatalogResponse = external_exports.object({
|
|
18673
|
+
catalog: external_exports.array(ConnectorCatalogEntry),
|
|
18674
|
+
connections: external_exports.array(
|
|
18675
|
+
external_exports.object({ id: MemberId.or(external_exports.string()), kind: ConnectorKind, name: external_exports.string() })
|
|
18676
|
+
)
|
|
18677
|
+
});
|
|
18678
|
+
|
|
18476
18679
|
// ../../packages/contracts/src/api.ts
|
|
18477
18680
|
var ProblemCode = external_exports.enum([
|
|
18478
18681
|
"network_unavailable",
|
|
@@ -18520,6 +18723,16 @@ var CreateOrgRequest = external_exports.object({
|
|
|
18520
18723
|
name: Org.shape.name,
|
|
18521
18724
|
slug: Org.shape.slug
|
|
18522
18725
|
});
|
|
18726
|
+
var RenameOrgRequest = external_exports.object({
|
|
18727
|
+
// Trimmed before the length checks so surrounding whitespace cannot pass as a
|
|
18728
|
+
// name and leave the organization blank everywhere its name is displayed.
|
|
18729
|
+
name: external_exports.string().trim().pipe(Org.shape.name)
|
|
18730
|
+
});
|
|
18731
|
+
var DeleteOrgRequest = external_exports.object({
|
|
18732
|
+
/** Exact current display name; this is the irreversible-action fence. */
|
|
18733
|
+
name: Org.shape.name
|
|
18734
|
+
}).strict();
|
|
18735
|
+
var DeleteOrgResponse = external_exports.object({ deleted: external_exports.literal(true) }).strict();
|
|
18523
18736
|
var DESKTOP_SIDEBAR_MIN_WIDTH_PX = 240;
|
|
18524
18737
|
var DESKTOP_SIDEBAR_MAX_WIDTH_PX = 420;
|
|
18525
18738
|
var TASK_SIDEBAR_MIN_WIDTH_PX = 240;
|
|
@@ -18821,6 +19034,15 @@ var HostConsoleResponse = external_exports.object({
|
|
|
18821
19034
|
available: external_exports.boolean()
|
|
18822
19035
|
});
|
|
18823
19036
|
var HostUpdateResponse = external_exports.object({ accepted: external_exports.literal(true) });
|
|
19037
|
+
var MachineMemoryEntry = MemoryEntry.omit({ machine: true }).extend({
|
|
19038
|
+
agentName: external_exports.string().min(1).max(120)
|
|
19039
|
+
});
|
|
19040
|
+
var MachineMemoriesResponse = external_exports.object({
|
|
19041
|
+
/** Machine-scoped memory across the organization's teammates, newest first. */
|
|
19042
|
+
memories: external_exports.array(MachineMemoryEntry).max(200).default([]),
|
|
19043
|
+
/** True when older entries exist beyond the bounded set; never silent. */
|
|
19044
|
+
truncated: external_exports.boolean().default(false)
|
|
19045
|
+
});
|
|
18824
19046
|
|
|
18825
19047
|
// ../../packages/contracts/src/redaction.ts
|
|
18826
19048
|
var REDACTED_CREDENTIAL = "[REDACTED]";
|
|
@@ -19918,186 +20140,6 @@ var BrowserOAuthConfig = external_exports.object({
|
|
|
19918
20140
|
githubAppSlug: GithubAppSlug.nullable()
|
|
19919
20141
|
}).strict();
|
|
19920
20142
|
|
|
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
20143
|
// ../../packages/contracts/src/secrets-env.ts
|
|
20102
20144
|
var BLOCKED_SECRET_ENV = /* @__PURE__ */ new Set([
|
|
20103
20145
|
"NODE_OPTIONS",
|
|
@@ -20501,7 +20543,7 @@ async function generateTaskTitle(instructions, runner) {
|
|
|
20501
20543
|
instructions.slice(0, INSTRUCTIONS_BUDGET),
|
|
20502
20544
|
"</task_request>"
|
|
20503
20545
|
].join("\n");
|
|
20504
|
-
return new Promise((
|
|
20546
|
+
return new Promise((resolve17) => {
|
|
20505
20547
|
const child = spawnCli(
|
|
20506
20548
|
command,
|
|
20507
20549
|
[
|
|
@@ -20524,7 +20566,7 @@ async function generateTaskTitle(instructions, runner) {
|
|
|
20524
20566
|
if (settled) return;
|
|
20525
20567
|
settled = true;
|
|
20526
20568
|
clearTimeout(timer);
|
|
20527
|
-
|
|
20569
|
+
resolve17(value);
|
|
20528
20570
|
};
|
|
20529
20571
|
const timer = setTimeout(() => {
|
|
20530
20572
|
child.kill();
|
|
@@ -20846,11 +20888,11 @@ function createWorkerWatchdogSendDrain() {
|
|
|
20846
20888
|
if (completed) return;
|
|
20847
20889
|
completed = true;
|
|
20848
20890
|
pending--;
|
|
20849
|
-
if (pending === 0) drained.splice(0).forEach((
|
|
20891
|
+
if (pending === 0) drained.splice(0).forEach((resolve17) => resolve17());
|
|
20850
20892
|
};
|
|
20851
20893
|
},
|
|
20852
20894
|
drain: async () => {
|
|
20853
|
-
if (pending > 0) await new Promise((
|
|
20895
|
+
if (pending > 0) await new Promise((resolve17) => drained.push(resolve17));
|
|
20854
20896
|
}
|
|
20855
20897
|
};
|
|
20856
20898
|
}
|
|
@@ -21095,7 +21137,7 @@ async function waitForOperationGrantRetry(retryAt, signal) {
|
|
|
21095
21137
|
const deadline = Date.parse(retryAt);
|
|
21096
21138
|
if (!Number.isFinite(deadline) || signal.aborted) return false;
|
|
21097
21139
|
if (deadline <= Date.now()) return true;
|
|
21098
|
-
return await new Promise((
|
|
21140
|
+
return await new Promise((resolve17) => {
|
|
21099
21141
|
let settled = false;
|
|
21100
21142
|
let timer;
|
|
21101
21143
|
const finish = (ready) => {
|
|
@@ -21103,7 +21145,7 @@ async function waitForOperationGrantRetry(retryAt, signal) {
|
|
|
21103
21145
|
settled = true;
|
|
21104
21146
|
if (timer) clearTimeout(timer);
|
|
21105
21147
|
signal.removeEventListener("abort", onAbort);
|
|
21106
|
-
|
|
21148
|
+
resolve17(ready);
|
|
21107
21149
|
};
|
|
21108
21150
|
const onAbort = () => finish(false);
|
|
21109
21151
|
const schedule = () => {
|
|
@@ -21371,22 +21413,22 @@ var HostClient = class _HostClient {
|
|
|
21371
21413
|
const unwindingAssignments = [...this.activeAssignments.values()];
|
|
21372
21414
|
for (const cancel of this.cancels.values()) cancel(stopReason);
|
|
21373
21415
|
for (const entry of this.secretGrants.values()) {
|
|
21374
|
-
for (const
|
|
21416
|
+
for (const resolve17 of entry.resolvers) resolve17({});
|
|
21375
21417
|
entry.resolvers = [];
|
|
21376
21418
|
delete entry.value;
|
|
21377
21419
|
}
|
|
21378
21420
|
for (const entry of this.connectionGrants.values()) {
|
|
21379
|
-
for (const
|
|
21421
|
+
for (const resolve17 of entry.resolvers) resolve17([]);
|
|
21380
21422
|
entry.resolvers = [];
|
|
21381
21423
|
delete entry.value;
|
|
21382
21424
|
}
|
|
21383
21425
|
for (const entry of this.providerGrants.values()) {
|
|
21384
|
-
for (const
|
|
21426
|
+
for (const resolve17 of entry.resolvers) resolve17([]);
|
|
21385
21427
|
entry.resolvers = [];
|
|
21386
21428
|
delete entry.value;
|
|
21387
21429
|
}
|
|
21388
21430
|
for (const waiters of this.approvalWaiters.values()) {
|
|
21389
|
-
for (const
|
|
21431
|
+
for (const resolve17 of waiters.values()) resolve17({ approved: false, guidance: reason });
|
|
21390
21432
|
}
|
|
21391
21433
|
for (const waiters of this.agentOpWaiters.values()) {
|
|
21392
21434
|
for (const waiter of waiters.values()) {
|
|
@@ -21412,9 +21454,9 @@ var HostClient = class _HostClient {
|
|
|
21412
21454
|
let drainTimer;
|
|
21413
21455
|
const drained = await Promise.race([
|
|
21414
21456
|
Promise.allSettled(runs).then(() => true),
|
|
21415
|
-
new Promise((
|
|
21457
|
+
new Promise((resolve17) => {
|
|
21416
21458
|
drainTimer = setTimeout(
|
|
21417
|
-
() =>
|
|
21459
|
+
() => resolve17(false),
|
|
21418
21460
|
this.opts.unwindTimeoutMs ?? _HostClient.DEFAULT_UNWIND_TIMEOUT_MS
|
|
21419
21461
|
);
|
|
21420
21462
|
drainTimer.unref?.();
|
|
@@ -21558,9 +21600,9 @@ var HostClient = class _HostClient {
|
|
|
21558
21600
|
let frameDrainTimer;
|
|
21559
21601
|
const framesDrained = await Promise.race([
|
|
21560
21602
|
frameTail.then(() => true),
|
|
21561
|
-
new Promise((
|
|
21603
|
+
new Promise((resolve17) => {
|
|
21562
21604
|
frameDrainTimer = setTimeout(
|
|
21563
|
-
() =>
|
|
21605
|
+
() => resolve17(false),
|
|
21564
21606
|
this.opts.unwindTimeoutMs ?? _HostClient.DEFAULT_UNWIND_TIMEOUT_MS
|
|
21565
21607
|
);
|
|
21566
21608
|
frameDrainTimer.unref?.();
|
|
@@ -22104,7 +22146,7 @@ var HostClient = class _HostClient {
|
|
|
22104
22146
|
const entry = this.secretGrants.get(key) ?? { resolvers: [] };
|
|
22105
22147
|
entry.value = message.secrets;
|
|
22106
22148
|
entry.expiresAt = expiresAt;
|
|
22107
|
-
for (const
|
|
22149
|
+
for (const resolve17 of entry.resolvers) resolve17(message.secrets);
|
|
22108
22150
|
entry.resolvers = [];
|
|
22109
22151
|
this.secretGrants.set(key, entry);
|
|
22110
22152
|
return;
|
|
@@ -22135,13 +22177,13 @@ var HostClient = class _HostClient {
|
|
|
22135
22177
|
const entry = this.connectionGrants.get(key) ?? { resolvers: [] };
|
|
22136
22178
|
entry.value = message.connections;
|
|
22137
22179
|
entry.expiresAt = expiresAt;
|
|
22138
|
-
for (const
|
|
22180
|
+
for (const resolve17 of entry.resolvers) resolve17(message.connections);
|
|
22139
22181
|
entry.resolvers = [];
|
|
22140
22182
|
this.connectionGrants.set(key, entry);
|
|
22141
22183
|
const providerEntry = this.providerGrants.get(key) ?? { resolvers: [] };
|
|
22142
22184
|
providerEntry.value = providers;
|
|
22143
22185
|
providerEntry.expiresAt = authorityExpiresAt;
|
|
22144
|
-
for (const
|
|
22186
|
+
for (const resolve17 of providerEntry.resolvers) resolve17(providers);
|
|
22145
22187
|
providerEntry.resolvers = [];
|
|
22146
22188
|
this.providerGrants.set(key, providerEntry);
|
|
22147
22189
|
return;
|
|
@@ -22275,8 +22317,8 @@ var HostClient = class _HostClient {
|
|
|
22275
22317
|
return redactCredentialText(text, sensitiveSnapshot()).slice(0, maxLength);
|
|
22276
22318
|
};
|
|
22277
22319
|
let resolveCancelled;
|
|
22278
|
-
const cancelledPromise = new Promise((
|
|
22279
|
-
resolveCancelled =
|
|
22320
|
+
const cancelledPromise = new Promise((resolve17) => {
|
|
22321
|
+
resolveCancelled = resolve17;
|
|
22280
22322
|
});
|
|
22281
22323
|
const endAuthority = (reason = "cloud_cancel") => {
|
|
22282
22324
|
if (stopReason) return;
|
|
@@ -22285,21 +22327,21 @@ var HostClient = class _HostClient {
|
|
|
22285
22327
|
authorityController.abort(reason);
|
|
22286
22328
|
const secretEntry = this.secretGrants.get(cancelKey);
|
|
22287
22329
|
if (secretEntry) {
|
|
22288
|
-
for (const
|
|
22330
|
+
for (const resolve17 of secretEntry.resolvers) resolve17({});
|
|
22289
22331
|
secretEntry.resolvers = [];
|
|
22290
22332
|
delete secretEntry.value;
|
|
22291
22333
|
}
|
|
22292
22334
|
this.secretGrants.delete(cancelKey);
|
|
22293
22335
|
const connectionEntry = this.connectionGrants.get(cancelKey);
|
|
22294
22336
|
if (connectionEntry) {
|
|
22295
|
-
for (const
|
|
22337
|
+
for (const resolve17 of connectionEntry.resolvers) resolve17([]);
|
|
22296
22338
|
connectionEntry.resolvers = [];
|
|
22297
22339
|
delete connectionEntry.value;
|
|
22298
22340
|
}
|
|
22299
22341
|
this.connectionGrants.delete(cancelKey);
|
|
22300
22342
|
const providerEntry = this.providerGrants.get(cancelKey);
|
|
22301
22343
|
if (providerEntry) {
|
|
22302
|
-
for (const
|
|
22344
|
+
for (const resolve17 of providerEntry.resolvers) resolve17([]);
|
|
22303
22345
|
providerEntry.resolvers = [];
|
|
22304
22346
|
delete providerEntry.value;
|
|
22305
22347
|
}
|
|
@@ -22307,8 +22349,8 @@ var HostClient = class _HostClient {
|
|
|
22307
22349
|
this.clearAuthorityExpiry(cancelKey);
|
|
22308
22350
|
const approvalWaiters = this.approvalWaiters.get(cancelKey);
|
|
22309
22351
|
if (approvalWaiters) {
|
|
22310
|
-
for (const
|
|
22311
|
-
|
|
22352
|
+
for (const resolve17 of approvalWaiters.values()) {
|
|
22353
|
+
resolve17({ approved: false, guidance: "task was cancelled" });
|
|
22312
22354
|
}
|
|
22313
22355
|
approvalWaiters.clear();
|
|
22314
22356
|
}
|
|
@@ -22434,9 +22476,9 @@ var HostClient = class _HostClient {
|
|
|
22434
22476
|
return value;
|
|
22435
22477
|
};
|
|
22436
22478
|
if (entry.value) return Promise.resolve(capture(entry.value));
|
|
22437
|
-
return new Promise((
|
|
22438
|
-
entry.resolvers.push((value) =>
|
|
22439
|
-
setTimeout(() =>
|
|
22479
|
+
return new Promise((resolve17) => {
|
|
22480
|
+
entry.resolvers.push((value) => resolve17(capture(value)));
|
|
22481
|
+
setTimeout(() => resolve17(capture(entry.value ?? {})), _HostClient.SECRETS_WAIT_MS);
|
|
22440
22482
|
});
|
|
22441
22483
|
};
|
|
22442
22484
|
const connections = () => {
|
|
@@ -22453,9 +22495,9 @@ var HostClient = class _HostClient {
|
|
|
22453
22495
|
return value;
|
|
22454
22496
|
};
|
|
22455
22497
|
if (entry.value) return Promise.resolve(capture(entry.value));
|
|
22456
|
-
return new Promise((
|
|
22457
|
-
entry.resolvers.push((value) =>
|
|
22458
|
-
setTimeout(() =>
|
|
22498
|
+
return new Promise((resolve17) => {
|
|
22499
|
+
entry.resolvers.push((value) => resolve17(capture(value)));
|
|
22500
|
+
setTimeout(() => resolve17(capture(entry.value ?? [])), _HostClient.SECRETS_WAIT_MS);
|
|
22459
22501
|
});
|
|
22460
22502
|
};
|
|
22461
22503
|
const providers = () => {
|
|
@@ -22472,9 +22514,9 @@ var HostClient = class _HostClient {
|
|
|
22472
22514
|
return value;
|
|
22473
22515
|
};
|
|
22474
22516
|
if (entry.value !== void 0) return Promise.resolve(capture(entry.value));
|
|
22475
|
-
return new Promise((
|
|
22476
|
-
entry.resolvers.push((value) =>
|
|
22477
|
-
setTimeout(() =>
|
|
22517
|
+
return new Promise((resolve17) => {
|
|
22518
|
+
entry.resolvers.push((value) => resolve17(capture(value)));
|
|
22519
|
+
setTimeout(() => resolve17(capture(entry.value ?? [])), _HostClient.SECRETS_WAIT_MS);
|
|
22478
22520
|
});
|
|
22479
22521
|
};
|
|
22480
22522
|
const linear = async () => {
|
|
@@ -22500,13 +22542,13 @@ var HostClient = class _HostClient {
|
|
|
22500
22542
|
payload: safe(payload, 5e4),
|
|
22501
22543
|
...questionChoices ? { questionChoices: [...questionChoices] } : {}
|
|
22502
22544
|
});
|
|
22503
|
-
return new Promise((
|
|
22545
|
+
return new Promise((resolve17) => {
|
|
22504
22546
|
const waiters = this.approvalWaiters.get(cancelKey) ?? /* @__PURE__ */ new Map();
|
|
22505
22547
|
this.approvalWaiters.set(cancelKey, waiters);
|
|
22506
|
-
waiters.set(requestId,
|
|
22548
|
+
waiters.set(requestId, resolve17);
|
|
22507
22549
|
void cancelledPromise.then(() => {
|
|
22508
22550
|
if (waiters.delete(requestId)) {
|
|
22509
|
-
|
|
22551
|
+
resolve17({ approved: false, guidance: "task was cancelled" });
|
|
22510
22552
|
}
|
|
22511
22553
|
});
|
|
22512
22554
|
});
|
|
@@ -22552,11 +22594,11 @@ var HostClient = class _HostClient {
|
|
|
22552
22594
|
if (existing) message = existing;
|
|
22553
22595
|
else terminalMessages.set(requestId, message);
|
|
22554
22596
|
}
|
|
22555
|
-
return new Promise((
|
|
22597
|
+
return new Promise((resolve17) => {
|
|
22556
22598
|
const waiters = this.agentOpWaiters.get(cancelKey) ?? /* @__PURE__ */ new Map();
|
|
22557
22599
|
this.agentOpWaiters.set(cancelKey, waiters);
|
|
22558
22600
|
if (waiters.has(requestId)) {
|
|
22559
|
-
|
|
22601
|
+
resolve17({ ok: false, error: "provider settlement request is already in flight" });
|
|
22560
22602
|
return;
|
|
22561
22603
|
}
|
|
22562
22604
|
const timer = setTimeout(() => {
|
|
@@ -22567,7 +22609,7 @@ var HostClient = class _HostClient {
|
|
|
22567
22609
|
(pending) => !(pending.type === "agent.op" && pending.requestId === requestId)
|
|
22568
22610
|
);
|
|
22569
22611
|
}
|
|
22570
|
-
|
|
22612
|
+
resolve17({
|
|
22571
22613
|
ok: false,
|
|
22572
22614
|
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
22615
|
});
|
|
@@ -22575,7 +22617,7 @@ var HostClient = class _HostClient {
|
|
|
22575
22617
|
}, _HostClient.AGENT_OP_TIMEOUT_MS);
|
|
22576
22618
|
timer.unref?.();
|
|
22577
22619
|
waiters.set(requestId, {
|
|
22578
|
-
resolve:
|
|
22620
|
+
resolve: resolve17,
|
|
22579
22621
|
timer,
|
|
22580
22622
|
...terminal ? { terminalMessage: message } : {}
|
|
22581
22623
|
});
|
|
@@ -22621,12 +22663,12 @@ var HostClient = class _HostClient {
|
|
|
22621
22663
|
"No GitHub change was attempted; the authority grant request was invalid."
|
|
22622
22664
|
);
|
|
22623
22665
|
}
|
|
22624
|
-
const outcome = await new Promise((
|
|
22666
|
+
const outcome = await new Promise((resolve17) => {
|
|
22625
22667
|
const timer = setTimeout(() => {
|
|
22626
22668
|
const waiter = this.operationGrantWaiters.get(requestId);
|
|
22627
22669
|
if (!waiter) return;
|
|
22628
22670
|
this.operationGrantWaiters.delete(requestId);
|
|
22629
|
-
|
|
22671
|
+
resolve17({ grant: null, retryable: true, reason: "no_reply_from_zixt" });
|
|
22630
22672
|
}, this.operationGrantTimeoutMs);
|
|
22631
22673
|
timer.unref?.();
|
|
22632
22674
|
this.operationGrantWaiters.set(requestId, {
|
|
@@ -22639,9 +22681,9 @@ var HostClient = class _HostClient {
|
|
|
22639
22681
|
timer,
|
|
22640
22682
|
accept: (grant) => {
|
|
22641
22683
|
addSensitiveValues(providerGrantSensitiveValues(grant));
|
|
22642
|
-
|
|
22684
|
+
resolve17({ grant });
|
|
22643
22685
|
},
|
|
22644
|
-
deny: (retryable, reason, detail, retryAt, retryCode) =>
|
|
22686
|
+
deny: (retryable, reason, detail, retryAt, retryCode) => resolve17({
|
|
22645
22687
|
grant: null,
|
|
22646
22688
|
retryable,
|
|
22647
22689
|
reason,
|
|
@@ -22655,7 +22697,7 @@ var HostClient = class _HostClient {
|
|
|
22655
22697
|
} catch {
|
|
22656
22698
|
clearTimeout(timer);
|
|
22657
22699
|
this.operationGrantWaiters.delete(requestId);
|
|
22658
|
-
|
|
22700
|
+
resolve17({ grant: null, retryable: false, reason: "connection_unavailable" });
|
|
22659
22701
|
}
|
|
22660
22702
|
});
|
|
22661
22703
|
if (outcome.grant) {
|
|
@@ -22711,7 +22753,7 @@ var HostClient = class _HostClient {
|
|
|
22711
22753
|
)
|
|
22712
22754
|
);
|
|
22713
22755
|
}
|
|
22714
|
-
return new Promise((
|
|
22756
|
+
return new Promise((resolve17, reject3) => {
|
|
22715
22757
|
const timer = setTimeout(() => {
|
|
22716
22758
|
if (this.browserCredentialWaiters.delete(requestId)) {
|
|
22717
22759
|
reject3(
|
|
@@ -22730,7 +22772,7 @@ var HostClient = class _HostClient {
|
|
|
22730
22772
|
timer,
|
|
22731
22773
|
accept: (credential) => {
|
|
22732
22774
|
addSensitiveValues(webLoginSensitiveValues(credential));
|
|
22733
|
-
|
|
22775
|
+
resolve17(credential);
|
|
22734
22776
|
},
|
|
22735
22777
|
deny: (reason) => reject3(new Error(reason))
|
|
22736
22778
|
});
|
|
@@ -23051,14 +23093,14 @@ async function observeWindowsGuardianNonce(pid, nonce) {
|
|
|
23051
23093
|
"Windows runner identity could not be observed"
|
|
23052
23094
|
);
|
|
23053
23095
|
}
|
|
23054
|
-
return new Promise((
|
|
23096
|
+
return new Promise((resolve17, reject3) => {
|
|
23055
23097
|
let done = false;
|
|
23056
23098
|
const finish = (result) => {
|
|
23057
23099
|
if (done) return;
|
|
23058
23100
|
done = true;
|
|
23059
23101
|
clearTimeout(timeout);
|
|
23060
23102
|
if (result instanceof Error) reject3(result);
|
|
23061
|
-
else
|
|
23103
|
+
else resolve17(result);
|
|
23062
23104
|
};
|
|
23063
23105
|
const timeout = setTimeout(
|
|
23064
23106
|
() => finish(
|
|
@@ -23103,7 +23145,7 @@ async function observePosixGuardianNonce(pid, nonce) {
|
|
|
23103
23145
|
);
|
|
23104
23146
|
}
|
|
23105
23147
|
}
|
|
23106
|
-
return new Promise((
|
|
23148
|
+
return new Promise((resolve17, reject3) => {
|
|
23107
23149
|
const observer = spawn2("/bin/ps", ["-ww", "-o", "command=", "-p", String(pid)], {
|
|
23108
23150
|
stdio: ["ignore", "pipe", "ignore"]
|
|
23109
23151
|
});
|
|
@@ -23114,7 +23156,7 @@ async function observePosixGuardianNonce(pid, nonce) {
|
|
|
23114
23156
|
done = true;
|
|
23115
23157
|
clearTimeout(timeout);
|
|
23116
23158
|
if (result instanceof Error) reject3(result);
|
|
23117
|
-
else
|
|
23159
|
+
else resolve17(result);
|
|
23118
23160
|
};
|
|
23119
23161
|
const timeout = setTimeout(() => {
|
|
23120
23162
|
observer.kill("SIGKILL");
|
|
@@ -23161,7 +23203,7 @@ async function observeGuardianIdentity(pid, identity) {
|
|
|
23161
23203
|
return process.platform === "win32" ? observeWindowsGuardianNonce(pid, identity.nonce) : observePosixGuardianNonce(pid, identity.nonce);
|
|
23162
23204
|
}
|
|
23163
23205
|
function delay(ms) {
|
|
23164
|
-
return new Promise((
|
|
23206
|
+
return new Promise((resolve17) => setTimeout(resolve17, ms));
|
|
23165
23207
|
}
|
|
23166
23208
|
function posixProcessRecordsFromPs(output) {
|
|
23167
23209
|
const records = [];
|
|
@@ -23194,7 +23236,7 @@ function posixProcessRecordsFromPs(output) {
|
|
|
23194
23236
|
return records;
|
|
23195
23237
|
}
|
|
23196
23238
|
async function snapshotPosixProcesses() {
|
|
23197
|
-
return new Promise((
|
|
23239
|
+
return new Promise((resolve17, reject3) => {
|
|
23198
23240
|
const observer = spawn2("/bin/ps", ["-axo", "uid=,pid=,ppid=,pgid=,stat="], {
|
|
23199
23241
|
stdio: ["ignore", "pipe", "ignore"]
|
|
23200
23242
|
});
|
|
@@ -23207,7 +23249,7 @@ async function snapshotPosixProcesses() {
|
|
|
23207
23249
|
if (error52) reject3(error52);
|
|
23208
23250
|
else {
|
|
23209
23251
|
try {
|
|
23210
|
-
|
|
23252
|
+
resolve17(posixProcessRecordsFromPs(output));
|
|
23211
23253
|
} catch (caught) {
|
|
23212
23254
|
reject3(caught);
|
|
23213
23255
|
}
|
|
@@ -23542,7 +23584,7 @@ async function snapshotWindowsDescendants(rootPid) {
|
|
|
23542
23584
|
"Windows process-tree observation could not start"
|
|
23543
23585
|
);
|
|
23544
23586
|
}
|
|
23545
|
-
return new Promise((
|
|
23587
|
+
return new Promise((resolve17, reject3) => {
|
|
23546
23588
|
let done = false;
|
|
23547
23589
|
const timeout = setTimeout(() => {
|
|
23548
23590
|
if (done) return;
|
|
@@ -23569,7 +23611,7 @@ async function snapshotWindowsDescendants(rootPid) {
|
|
|
23569
23611
|
return;
|
|
23570
23612
|
}
|
|
23571
23613
|
try {
|
|
23572
|
-
|
|
23614
|
+
resolve17(completeWindowsDescendantPids(rootPid, processes));
|
|
23573
23615
|
} catch (caught) {
|
|
23574
23616
|
reject3(caught);
|
|
23575
23617
|
}
|
|
@@ -23616,7 +23658,7 @@ async function waitForProcessesExit(pids, timeoutMs) {
|
|
|
23616
23658
|
}
|
|
23617
23659
|
async function runTaskkill(pid, command, timeoutMs = TASKKILL_TIMEOUT_MS, independentlyTrackedPids = []) {
|
|
23618
23660
|
const trustedCommand = command ?? defaultTaskkillCommand();
|
|
23619
|
-
const result = await new Promise((
|
|
23661
|
+
const result = await new Promise((resolve17, reject3) => {
|
|
23620
23662
|
const killer = spawn2(trustedCommand, ["/PID", String(pid), "/T", "/F"], {
|
|
23621
23663
|
stdio: ["ignore", "pipe", "pipe"],
|
|
23622
23664
|
windowsHide: true
|
|
@@ -23651,7 +23693,7 @@ async function runTaskkill(pid, command, timeoutMs = TASKKILL_TIMEOUT_MS, indepe
|
|
|
23651
23693
|
done = true;
|
|
23652
23694
|
clearTimeout(timeout);
|
|
23653
23695
|
if (error52) reject3(error52);
|
|
23654
|
-
else
|
|
23696
|
+
else resolve17({ code: killer.exitCode, output, outputTruncated });
|
|
23655
23697
|
};
|
|
23656
23698
|
killer.once(
|
|
23657
23699
|
"error",
|
|
@@ -24328,12 +24370,12 @@ async function createWindowsJobContainment(pid, options) {
|
|
|
24328
24370
|
stderr = `${stderr}${String(chunk)}`.slice(-HELPER_OUTPUT_LIMIT);
|
|
24329
24371
|
});
|
|
24330
24372
|
const helperEvents = helper;
|
|
24331
|
-
const exited = new Promise((
|
|
24373
|
+
const exited = new Promise((resolve17) => {
|
|
24332
24374
|
let completed = false;
|
|
24333
24375
|
const complete = (code, signal) => {
|
|
24334
24376
|
if (completed) return;
|
|
24335
24377
|
completed = true;
|
|
24336
|
-
|
|
24378
|
+
resolve17({ code, signal });
|
|
24337
24379
|
};
|
|
24338
24380
|
helperEvents.once("error", () => {
|
|
24339
24381
|
failProtocol(new Error("Windows Job Object helper could not start"));
|
|
@@ -24346,7 +24388,7 @@ async function createWindowsJobContainment(pid, options) {
|
|
|
24346
24388
|
});
|
|
24347
24389
|
const nextLine = async (expected) => {
|
|
24348
24390
|
if (protocolFailure) throw protocolFailure;
|
|
24349
|
-
const line = lines.shift() ?? await new Promise((
|
|
24391
|
+
const line = lines.shift() ?? await new Promise((resolve17, reject3) => {
|
|
24350
24392
|
const timer = setTimeout(
|
|
24351
24393
|
() => reject3(timeoutError("Windows Job Object helper did not answer in time")),
|
|
24352
24394
|
timeoutMs
|
|
@@ -24354,7 +24396,7 @@ async function createWindowsJobContainment(pid, options) {
|
|
|
24354
24396
|
timer.unref?.();
|
|
24355
24397
|
lineWaiters.push((value) => {
|
|
24356
24398
|
clearTimeout(timer);
|
|
24357
|
-
|
|
24399
|
+
resolve17(value);
|
|
24358
24400
|
});
|
|
24359
24401
|
});
|
|
24360
24402
|
if (protocolFailure) throw protocolFailure;
|
|
@@ -24367,8 +24409,8 @@ async function createWindowsJobContainment(pid, options) {
|
|
|
24367
24409
|
}
|
|
24368
24410
|
const stopped = await Promise.race([
|
|
24369
24411
|
exited.then(() => true),
|
|
24370
|
-
new Promise((
|
|
24371
|
-
const timer = setTimeout(() =>
|
|
24412
|
+
new Promise((resolve17) => {
|
|
24413
|
+
const timer = setTimeout(() => resolve17(false), timeoutMs);
|
|
24372
24414
|
timer.unref?.();
|
|
24373
24415
|
})
|
|
24374
24416
|
]);
|
|
@@ -24427,7 +24469,7 @@ async function awaitWindowsContainmentGate(env = process.env, input = process.st
|
|
|
24427
24469
|
if (nonce === void 0) return true;
|
|
24428
24470
|
if (!SAFE_NONCE2.test(nonce)) return false;
|
|
24429
24471
|
const expected = windowsContainmentGate(nonce).trimEnd();
|
|
24430
|
-
return new Promise((
|
|
24472
|
+
return new Promise((resolve17) => {
|
|
24431
24473
|
let pending = Buffer.alloc(0);
|
|
24432
24474
|
let settled = false;
|
|
24433
24475
|
const finish = (result) => {
|
|
@@ -24438,7 +24480,7 @@ async function awaitWindowsContainmentGate(env = process.env, input = process.st
|
|
|
24438
24480
|
input.off("end", onEnd);
|
|
24439
24481
|
input.off("error", onEnd);
|
|
24440
24482
|
if (result) input.pause();
|
|
24441
|
-
|
|
24483
|
+
resolve17(result);
|
|
24442
24484
|
};
|
|
24443
24485
|
const onData = (chunk) => {
|
|
24444
24486
|
pending = Buffer.concat([pending, chunk]);
|
|
@@ -24863,7 +24905,7 @@ async function installRelease(version2, options = {}) {
|
|
|
24863
24905
|
installerContainmentSetupError = error52;
|
|
24864
24906
|
return null;
|
|
24865
24907
|
}) : Promise.resolve(null);
|
|
24866
|
-
const installed = await new Promise((
|
|
24908
|
+
const installed = await new Promise((resolve17, reject3) => {
|
|
24867
24909
|
let finished = false;
|
|
24868
24910
|
let cleanupStarted = false;
|
|
24869
24911
|
let exitObserved = false;
|
|
@@ -24879,7 +24921,7 @@ async function installRelease(version2, options = {}) {
|
|
|
24879
24921
|
finished = true;
|
|
24880
24922
|
clearTimeout(timer);
|
|
24881
24923
|
options.signal?.removeEventListener("abort", requestCleanup);
|
|
24882
|
-
|
|
24924
|
+
resolve17(result);
|
|
24883
24925
|
};
|
|
24884
24926
|
const requestCleanup = () => {
|
|
24885
24927
|
if (cleanupStarted || finished) return;
|
|
@@ -25192,11 +25234,11 @@ async function runWorkerCompatibilityProxy(env = process.env, argv = process.arg
|
|
|
25192
25234
|
child.stdin?.on("error", () => {
|
|
25193
25235
|
});
|
|
25194
25236
|
process.stdin.pipe(child.stdin);
|
|
25195
|
-
return new Promise((
|
|
25196
|
-
child.once("error", () =>
|
|
25237
|
+
return new Promise((resolve17) => {
|
|
25238
|
+
child.once("error", () => resolve17(1));
|
|
25197
25239
|
child.once("exit", (code) => {
|
|
25198
25240
|
process.stdin.unpipe(child.stdin);
|
|
25199
|
-
|
|
25241
|
+
resolve17(code ?? 1);
|
|
25200
25242
|
});
|
|
25201
25243
|
});
|
|
25202
25244
|
}
|
|
@@ -25275,11 +25317,11 @@ async function launchHostSupervisor(options = {}) {
|
|
|
25275
25317
|
const waitOrStop = async (ms) => {
|
|
25276
25318
|
if (stopping) return false;
|
|
25277
25319
|
if (!customDelay) {
|
|
25278
|
-
await new Promise((
|
|
25320
|
+
await new Promise((resolve17) => {
|
|
25279
25321
|
const finish = () => {
|
|
25280
25322
|
clearTimeout(timer);
|
|
25281
25323
|
stopController.signal.removeEventListener("abort", finish);
|
|
25282
|
-
|
|
25324
|
+
resolve17();
|
|
25283
25325
|
};
|
|
25284
25326
|
const timer = setTimeout(finish, ms);
|
|
25285
25327
|
stopController.signal.addEventListener("abort", finish, { once: true });
|
|
@@ -25287,8 +25329,8 @@ async function launchHostSupervisor(options = {}) {
|
|
|
25287
25329
|
return !stopping;
|
|
25288
25330
|
}
|
|
25289
25331
|
let finishStop;
|
|
25290
|
-
const stopped = new Promise((
|
|
25291
|
-
finishStop = () =>
|
|
25332
|
+
const stopped = new Promise((resolve17) => {
|
|
25333
|
+
finishStop = () => resolve17();
|
|
25292
25334
|
stopController.signal.addEventListener("abort", finishStop, { once: true });
|
|
25293
25335
|
});
|
|
25294
25336
|
await Promise.race([customDelay(ms), stopped]);
|
|
@@ -25414,19 +25456,19 @@ async function launchHostSupervisor(options = {}) {
|
|
|
25414
25456
|
child = spawnSupervisor(entry, version2, ownershipDirectory, containmentGateNonce);
|
|
25415
25457
|
const launchedSupervisor = child;
|
|
25416
25458
|
let resolveChildExited;
|
|
25417
|
-
const childExited = new Promise((
|
|
25418
|
-
resolveChildExited =
|
|
25459
|
+
const childExited = new Promise((resolve17) => {
|
|
25460
|
+
resolveChildExited = resolve17;
|
|
25419
25461
|
});
|
|
25420
25462
|
const supervisorContainmentAbort = new AbortController();
|
|
25421
25463
|
void childExited.then(() => supervisorContainmentAbort.abort());
|
|
25422
25464
|
const outcomePromise = new Promise(
|
|
25423
|
-
(
|
|
25465
|
+
(resolve17) => {
|
|
25424
25466
|
let observed = false;
|
|
25425
25467
|
const finish = (code, signal) => {
|
|
25426
25468
|
if (observed) return;
|
|
25427
25469
|
observed = true;
|
|
25428
25470
|
resolveChildExited();
|
|
25429
|
-
|
|
25471
|
+
resolve17({ code, signal });
|
|
25430
25472
|
};
|
|
25431
25473
|
child.once("error", () => finish(1, null));
|
|
25432
25474
|
child.once("exit", finish);
|
|
@@ -25447,12 +25489,12 @@ async function launchHostSupervisor(options = {}) {
|
|
|
25447
25489
|
if (!supervisorContainment || !launchedSupervisor.stdin) {
|
|
25448
25490
|
throw new Error("supervisor Job Object gate is unavailable");
|
|
25449
25491
|
}
|
|
25450
|
-
await new Promise((
|
|
25492
|
+
await new Promise((resolve17, reject3) => {
|
|
25451
25493
|
launchedSupervisor.stdin.write(
|
|
25452
25494
|
windowsContainmentGate(containmentGateNonce),
|
|
25453
25495
|
(error52) => {
|
|
25454
25496
|
if (error52) reject3(error52);
|
|
25455
|
-
else
|
|
25497
|
+
else resolve17();
|
|
25456
25498
|
}
|
|
25457
25499
|
);
|
|
25458
25500
|
});
|
|
@@ -25594,18 +25636,18 @@ async function superviseHost(options = {}) {
|
|
|
25594
25636
|
}
|
|
25595
25637
|
}
|
|
25596
25638
|
let announceShutdown;
|
|
25597
|
-
const shutdownAnnounced = new Promise((
|
|
25598
|
-
announceShutdown =
|
|
25639
|
+
const shutdownAnnounced = new Promise((resolve17) => {
|
|
25640
|
+
announceShutdown = resolve17;
|
|
25599
25641
|
});
|
|
25600
25642
|
const attempted = /* @__PURE__ */ new Set();
|
|
25601
25643
|
const waitOrShutdown = async (ms) => {
|
|
25602
25644
|
if (shuttingDown2) return false;
|
|
25603
25645
|
if (!customDelay) {
|
|
25604
|
-
await new Promise((
|
|
25646
|
+
await new Promise((resolve17) => {
|
|
25605
25647
|
const finish = () => {
|
|
25606
25648
|
clearTimeout(timer);
|
|
25607
25649
|
shutdownController.signal.removeEventListener("abort", finish);
|
|
25608
|
-
|
|
25650
|
+
resolve17();
|
|
25609
25651
|
};
|
|
25610
25652
|
const timer = setTimeout(finish, ms);
|
|
25611
25653
|
shutdownController.signal.addEventListener("abort", finish, { once: true });
|
|
@@ -25748,19 +25790,19 @@ async function superviseHost(options = {}) {
|
|
|
25748
25790
|
child = spawnWorker(command, watchdogLaunch, compatibilityOwnership, containmentGateNonce);
|
|
25749
25791
|
const watchedChild = child;
|
|
25750
25792
|
let resolveChildExited;
|
|
25751
|
-
const childExited = new Promise((
|
|
25752
|
-
resolveChildExited =
|
|
25793
|
+
const childExited = new Promise((resolve17) => {
|
|
25794
|
+
resolveChildExited = resolve17;
|
|
25753
25795
|
});
|
|
25754
25796
|
const workerContainmentAbort = new AbortController();
|
|
25755
25797
|
void childExited.then(() => workerContainmentAbort.abort());
|
|
25756
25798
|
const outcomePromise = new Promise(
|
|
25757
|
-
(
|
|
25799
|
+
(resolve17) => {
|
|
25758
25800
|
let observed = false;
|
|
25759
25801
|
const finish = (result) => {
|
|
25760
25802
|
if (observed) return;
|
|
25761
25803
|
observed = true;
|
|
25762
25804
|
resolveChildExited();
|
|
25763
|
-
|
|
25805
|
+
resolve17(result);
|
|
25764
25806
|
};
|
|
25765
25807
|
watchedChild.once("error", () => finish({ code: 1, signal: null }));
|
|
25766
25808
|
watchedChild.once(
|
|
@@ -25782,10 +25824,10 @@ async function superviseHost(options = {}) {
|
|
|
25782
25824
|
if (!workerContainment || !watchedChild.stdin) {
|
|
25783
25825
|
throw new Error("worker Job Object gate is unavailable");
|
|
25784
25826
|
}
|
|
25785
|
-
await new Promise((
|
|
25827
|
+
await new Promise((resolve17, reject3) => {
|
|
25786
25828
|
watchedChild.stdin.write(windowsContainmentGate(containmentGateNonce), (error52) => {
|
|
25787
25829
|
if (error52) reject3(error52);
|
|
25788
|
-
else
|
|
25830
|
+
else resolve17();
|
|
25789
25831
|
});
|
|
25790
25832
|
});
|
|
25791
25833
|
}
|
|
@@ -26049,7 +26091,47 @@ async function superviseHost(options = {}) {
|
|
|
26049
26091
|
}
|
|
26050
26092
|
|
|
26051
26093
|
// src/index.ts
|
|
26052
|
-
import { hostname as hostname3 } from "node:os";
|
|
26094
|
+
import { homedir as homedir12, hostname as hostname3 } from "node:os";
|
|
26095
|
+
|
|
26096
|
+
// src/hardware.ts
|
|
26097
|
+
import { existsSync } from "node:fs";
|
|
26098
|
+
import { statfs } from "node:fs/promises";
|
|
26099
|
+
import { cpus, freemem, homedir as homedir2, totalmem } from "node:os";
|
|
26100
|
+
import { dirname as dirname4, resolve as resolve5 } from "node:path";
|
|
26101
|
+
async function machineHardware(workRoot = homedir2()) {
|
|
26102
|
+
return {
|
|
26103
|
+
// A container or cgroup can hide processors from this count; it is what
|
|
26104
|
+
// this process can see, which is what its Tasks will actually get.
|
|
26105
|
+
cpuCount: Math.max(1, cpus().length),
|
|
26106
|
+
memoryTotalBytes: totalmem(),
|
|
26107
|
+
memoryFreeBytes: freemem(),
|
|
26108
|
+
disk: await diskSpace(workRoot)
|
|
26109
|
+
};
|
|
26110
|
+
}
|
|
26111
|
+
async function diskSpace(workRoot) {
|
|
26112
|
+
const measured = nearestExistingPath(workRoot);
|
|
26113
|
+
if (!measured) return null;
|
|
26114
|
+
try {
|
|
26115
|
+
const stats = await statfs(measured);
|
|
26116
|
+
const blockSize = Number(stats.bsize);
|
|
26117
|
+
const freeBytes = Number(stats.bavail) * blockSize;
|
|
26118
|
+
const totalBytes = Number(stats.blocks) * blockSize;
|
|
26119
|
+
if (!Number.isSafeInteger(totalBytes) || !Number.isSafeInteger(freeBytes)) return null;
|
|
26120
|
+
return { path: measured, totalBytes, freeBytes: Math.min(freeBytes, totalBytes) };
|
|
26121
|
+
} catch {
|
|
26122
|
+
return null;
|
|
26123
|
+
}
|
|
26124
|
+
}
|
|
26125
|
+
function nearestExistingPath(start) {
|
|
26126
|
+
let candidate = resolve5(start);
|
|
26127
|
+
for (let depth = 0; depth < 16; depth++) {
|
|
26128
|
+
if (existsSync(candidate)) return candidate;
|
|
26129
|
+
const parent = dirname4(candidate);
|
|
26130
|
+
if (parent === candidate) return null;
|
|
26131
|
+
candidate = parent;
|
|
26132
|
+
}
|
|
26133
|
+
return null;
|
|
26134
|
+
}
|
|
26053
26135
|
|
|
26054
26136
|
// src/browser/adapter.ts
|
|
26055
26137
|
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 +26321,15 @@ function createDemoBrowserAdapterFactory() {
|
|
|
26239
26321
|
|
|
26240
26322
|
// src/browser/manager.ts
|
|
26241
26323
|
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
|
|
26324
|
+
import { homedir as homedir3 } from "node:os";
|
|
26325
|
+
import { dirname as dirname5, join as join7, resolve as resolve6 } from "node:path";
|
|
26244
26326
|
var SAFE_SEGMENT = /^[A-Za-z0-9_-]{1,200}$/;
|
|
26245
26327
|
var FRAME_MIN_INTERVAL_MS = 100;
|
|
26246
26328
|
var IDLE_TIMEOUT_MS = 15 * 6e4;
|
|
26247
26329
|
var BrowserManager = class {
|
|
26248
26330
|
constructor(opts) {
|
|
26249
26331
|
this.opts = opts;
|
|
26250
|
-
this.profileRoot = opts.profileRoot ?? join7(
|
|
26332
|
+
this.profileRoot = opts.profileRoot ?? join7(homedir3(), ".zixt", "browser-profiles");
|
|
26251
26333
|
this.profileStateRoot = join7(this.profileRoot, ".profile-state");
|
|
26252
26334
|
this.viewport = opts.viewport ?? BROWSER_DEFAULT_VIEWPORT;
|
|
26253
26335
|
this.idleTimeoutMs = opts.idleTimeoutMs ?? IDLE_TIMEOUT_MS;
|
|
@@ -26338,9 +26420,9 @@ var BrowserManager = class {
|
|
|
26338
26420
|
}
|
|
26339
26421
|
}
|
|
26340
26422
|
exactChild(root, child) {
|
|
26341
|
-
const canonicalRoot =
|
|
26342
|
-
const target =
|
|
26343
|
-
if (
|
|
26423
|
+
const canonicalRoot = resolve6(root);
|
|
26424
|
+
const target = resolve6(canonicalRoot, child);
|
|
26425
|
+
if (dirname5(target) !== canonicalRoot) {
|
|
26344
26426
|
throw new Error("browser profile path escaped its owned root");
|
|
26345
26427
|
}
|
|
26346
26428
|
return target;
|
|
@@ -27249,8 +27331,8 @@ function createPlaywrightBrowserAdapterFactory(dependencies = {}) {
|
|
|
27249
27331
|
import { spawn as spawn8 } from "node:child_process";
|
|
27250
27332
|
import { randomUUID as randomUUID10 } from "node:crypto";
|
|
27251
27333
|
import { lstat as lstat11, mkdir as mkdir10, realpath as realpath8 } from "node:fs/promises";
|
|
27252
|
-
import { homedir as
|
|
27253
|
-
import { dirname as
|
|
27334
|
+
import { homedir as homedir5 } from "node:os";
|
|
27335
|
+
import { dirname as dirname8, isAbsolute as isAbsolute14, join as join14, resolve as resolve10 } from "node:path";
|
|
27254
27336
|
|
|
27255
27337
|
// src/tool-packs/browser/authentication-wall.ts
|
|
27256
27338
|
var AUTH_PATH_SEGMENT = /(?:^|\/)(?:log[-_]?in|sign[-_]?in|sso|saml|auth|authorize|authenticate|oauth2?|session\/new|checkpoint)(?:\/|$)/i;
|
|
@@ -29976,7 +30058,7 @@ function createGithubPushOrchestrator(input) {
|
|
|
29976
30058
|
import { spawn as spawn5 } from "node:child_process";
|
|
29977
30059
|
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
29978
30060
|
import { chmod as chmod3, lstat as lstat7, mkdir as mkdir5, realpath as realpath4, rm as rm5 } from "node:fs/promises";
|
|
29979
|
-
import { dirname as
|
|
30061
|
+
import { dirname as dirname6, isAbsolute as isAbsolute9, join as join9, relative as relative5 } from "node:path";
|
|
29980
30062
|
|
|
29981
30063
|
// src/tool-packs/github/git-credential-broker.ts
|
|
29982
30064
|
import { createServer } from "node:http";
|
|
@@ -30227,7 +30309,7 @@ async function requireRealDirectory(path, label) {
|
|
|
30227
30309
|
async function validateTokenlessPaths(command) {
|
|
30228
30310
|
if (command.kind === "clone-from-bridge") {
|
|
30229
30311
|
if (!isAbsolute9(command.destination)) throw new GithubGitProcessError("invalid_input");
|
|
30230
|
-
const parent = await requireRealDirectory(
|
|
30312
|
+
const parent = await requireRealDirectory(dirname6(command.destination), "clone parent");
|
|
30231
30313
|
assertBelow(parent, command.destination, "clone destination");
|
|
30232
30314
|
const destination = await lstat7(command.destination).catch((error52) => {
|
|
30233
30315
|
if (error52.code === "ENOENT") return null;
|
|
@@ -30337,8 +30419,8 @@ async function runGit(input, args, env) {
|
|
|
30337
30419
|
let settled = false;
|
|
30338
30420
|
let stopping = false;
|
|
30339
30421
|
let resolveExited;
|
|
30340
|
-
const exited = new Promise((
|
|
30341
|
-
resolveExited =
|
|
30422
|
+
const exited = new Promise((resolve17) => {
|
|
30423
|
+
resolveExited = resolve17;
|
|
30342
30424
|
});
|
|
30343
30425
|
child.once("exit", resolveExited);
|
|
30344
30426
|
const cleanup = () => {
|
|
@@ -30986,7 +31068,7 @@ function createRepositoryTools(runtime) {
|
|
|
30986
31068
|
// src/tool-packs/github/workspace.ts
|
|
30987
31069
|
import { randomUUID as randomUUID8 } from "node:crypto";
|
|
30988
31070
|
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
|
|
31071
|
+
import { isAbsolute as isAbsolute10, join as join10, relative as relative6, resolve as resolve7 } from "node:path";
|
|
30990
31072
|
var SAFE_LOCAL_ID = /^[A-Za-z0-9_-]{1,200}$/;
|
|
30991
31073
|
var FULL_NAME2 = /^[A-Za-z0-9_.-]{1,100}\/[A-Za-z0-9_.-]{1,100}$/;
|
|
30992
31074
|
var DIRECTORY_MODE2 = 448;
|
|
@@ -31009,7 +31091,7 @@ function assertBelow2(parent, child, label) {
|
|
|
31009
31091
|
}
|
|
31010
31092
|
}
|
|
31011
31093
|
function samePath(left, right) {
|
|
31012
|
-
return process.platform === "win32" ?
|
|
31094
|
+
return process.platform === "win32" ? resolve7(left).toLowerCase() === resolve7(right).toLowerCase() : resolve7(left) === resolve7(right);
|
|
31013
31095
|
}
|
|
31014
31096
|
async function requireRealDirectory2(path, label) {
|
|
31015
31097
|
const entry = await lstat8(path).catch(() => null);
|
|
@@ -32826,8 +32908,8 @@ var linearToolPackFactory = {
|
|
|
32826
32908
|
async create(grant, context) {
|
|
32827
32909
|
let resolveCancelled;
|
|
32828
32910
|
let closed = false;
|
|
32829
|
-
const cancelled = new Promise((
|
|
32830
|
-
resolveCancelled =
|
|
32911
|
+
const cancelled = new Promise((resolve17) => {
|
|
32912
|
+
resolveCancelled = resolve17;
|
|
32831
32913
|
});
|
|
32832
32914
|
const cancel = () => {
|
|
32833
32915
|
if (closed) return;
|
|
@@ -33627,7 +33709,7 @@ function createAskUserServer() {
|
|
|
33627
33709
|
let server;
|
|
33628
33710
|
let listening;
|
|
33629
33711
|
function ensureListening() {
|
|
33630
|
-
listening ??= new Promise((
|
|
33712
|
+
listening ??= new Promise((resolve17, reject3) => {
|
|
33631
33713
|
server = createServer2((req, res) => {
|
|
33632
33714
|
res.on("error", () => {
|
|
33633
33715
|
});
|
|
@@ -33643,7 +33725,7 @@ function createAskUserServer() {
|
|
|
33643
33725
|
server.on("error", reject3);
|
|
33644
33726
|
server.listen(0, "127.0.0.1", () => {
|
|
33645
33727
|
const address = server.address();
|
|
33646
|
-
if (address && typeof address === "object")
|
|
33728
|
+
if (address && typeof address === "object") resolve17(address.port);
|
|
33647
33729
|
else reject3(new Error("ask_user server failed to bind"));
|
|
33648
33730
|
});
|
|
33649
33731
|
server.unref();
|
|
@@ -34667,7 +34749,7 @@ password=${credential.accessToken}
|
|
|
34667
34749
|
|
|
34668
34750
|
// src/runners/working-context.ts
|
|
34669
34751
|
import { spawn as spawn6 } from "node:child_process";
|
|
34670
|
-
import { resolve as
|
|
34752
|
+
import { resolve as resolve8 } from "node:path";
|
|
34671
34753
|
var COMMAND_TIMEOUT_MS = 5e3;
|
|
34672
34754
|
var OUTPUT_LIMIT_BYTES = 128 * 1024;
|
|
34673
34755
|
var COMMAND_STOP_TIMEOUT_MS = 2e4;
|
|
@@ -35062,8 +35144,8 @@ async function repositoryState(directory, git, env, signal) {
|
|
|
35062
35144
|
const pathLines = paths.trim().split(/\r?\n/);
|
|
35063
35145
|
if (pathLines.length < 3 || !pathLines[0] || !pathLines[1] || !pathLines[2]) return null;
|
|
35064
35146
|
const root = pathLines[0];
|
|
35065
|
-
const gitDirectory =
|
|
35066
|
-
const commonDirectory =
|
|
35147
|
+
const gitDirectory = resolve8(directory, pathLines[1]);
|
|
35148
|
+
const commonDirectory = resolve8(directory, pathLines[2]);
|
|
35067
35149
|
const records = status.split(/\0|\r?\n/).filter(Boolean);
|
|
35068
35150
|
const rawBranch = statusField(records, "branch.head");
|
|
35069
35151
|
if (!rawBranch || rawBranch.length > 512 || !isSafeSingleLineDisplayText(rawBranch)) return null;
|
|
@@ -35228,8 +35310,8 @@ import {
|
|
|
35228
35310
|
rm as rm7,
|
|
35229
35311
|
writeFile as writeFile5
|
|
35230
35312
|
} from "node:fs/promises";
|
|
35231
|
-
import { homedir as
|
|
35232
|
-
import { dirname as
|
|
35313
|
+
import { homedir as homedir4 } from "node:os";
|
|
35314
|
+
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
35315
|
var SAFE_SEGMENT2 = /^[A-Za-z0-9_-]{1,200}$/;
|
|
35234
35316
|
var DIRECTORY_MODE4 = 448;
|
|
35235
35317
|
var FILE_MODE3 = 384;
|
|
@@ -35446,7 +35528,7 @@ foreach ($path in $paths) {
|
|
|
35446
35528
|
}
|
|
35447
35529
|
`;
|
|
35448
35530
|
function defaultRunArtifactRoot() {
|
|
35449
|
-
return join13(
|
|
35531
|
+
return join13(homedir4(), ".zixt", "run-artifacts");
|
|
35450
35532
|
}
|
|
35451
35533
|
function requireSafeSegment(value, field) {
|
|
35452
35534
|
if (!SAFE_SEGMENT2.test(value)) {
|
|
@@ -35490,10 +35572,10 @@ async function rejectWindowsSymlinkAncestors(profile, target) {
|
|
|
35490
35572
|
}
|
|
35491
35573
|
}
|
|
35492
35574
|
async function prepareRoot(root) {
|
|
35493
|
-
const absolute =
|
|
35575
|
+
const absolute = resolve9(root);
|
|
35494
35576
|
let realProfile;
|
|
35495
35577
|
if (process.platform === "win32") {
|
|
35496
|
-
const profile =
|
|
35578
|
+
const profile = resolve9(homedir4());
|
|
35497
35579
|
assertWindowsProfileBoundary(profile, absolute);
|
|
35498
35580
|
await rejectWindowsSymlinkAncestors(profile, absolute);
|
|
35499
35581
|
realProfile = await realpath7(profile);
|
|
@@ -35663,10 +35745,10 @@ async function removePrivateTreeWithRetries(path, removeTree, retryDelayMs) {
|
|
|
35663
35745
|
}
|
|
35664
35746
|
}
|
|
35665
35747
|
async function sweepOrphanedRunArtifacts(root) {
|
|
35666
|
-
const absolute =
|
|
35748
|
+
const absolute = resolve9(root);
|
|
35667
35749
|
let realProfile;
|
|
35668
35750
|
if (process.platform === "win32") {
|
|
35669
|
-
const profile =
|
|
35751
|
+
const profile = resolve9(homedir4());
|
|
35670
35752
|
assertWindowsProfileBoundary(profile, absolute);
|
|
35671
35753
|
await rejectWindowsSymlinkAncestors(profile, absolute);
|
|
35672
35754
|
realProfile = await realpath7(profile);
|
|
@@ -35698,7 +35780,7 @@ async function sweepOrphanedRunArtifacts(root) {
|
|
|
35698
35780
|
return removed;
|
|
35699
35781
|
}
|
|
35700
35782
|
function defaultRunRegistryRoot() {
|
|
35701
|
-
return join13(
|
|
35783
|
+
return join13(homedir4(), ".zixt", "run-registry");
|
|
35702
35784
|
}
|
|
35703
35785
|
async function syncRunRegistryDirectory(path) {
|
|
35704
35786
|
const handle = await open5(path, "r");
|
|
@@ -35711,9 +35793,9 @@ async function syncRunRegistryDirectory(path) {
|
|
|
35711
35793
|
async function ensureDurableRunRegistryRoot(registryRoot, syncDirectory7) {
|
|
35712
35794
|
const firstCreated = await mkdir9(registryRoot, { recursive: true, mode: DIRECTORY_MODE4 });
|
|
35713
35795
|
if (firstCreated && process.platform !== "win32") {
|
|
35714
|
-
const first =
|
|
35715
|
-
const target =
|
|
35716
|
-
await syncDirectory7(
|
|
35796
|
+
const first = resolve9(firstCreated);
|
|
35797
|
+
const target = resolve9(registryRoot);
|
|
35798
|
+
await syncDirectory7(dirname7(first));
|
|
35717
35799
|
let current = first;
|
|
35718
35800
|
for (const part of relative8(first, target).split(sep4).filter(Boolean)) {
|
|
35719
35801
|
await syncDirectory7(current);
|
|
@@ -35888,7 +35970,7 @@ async function settlesWithin(promise2, timeoutMs) {
|
|
|
35888
35970
|
}
|
|
35889
35971
|
}
|
|
35890
35972
|
function defaultRunnerWorkspaceRoot() {
|
|
35891
|
-
return join14(
|
|
35973
|
+
return join14(homedir5(), ".zixt", "workspaces");
|
|
35892
35974
|
}
|
|
35893
35975
|
function defaultRunnerArtifactRoot() {
|
|
35894
35976
|
return defaultRunArtifactRoot();
|
|
@@ -35948,7 +36030,7 @@ function createCliRunner(adapter, opts = {}) {
|
|
|
35948
36030
|
const prefixArgs = opts.commandPrefixArgs ?? [];
|
|
35949
36031
|
const maxWallTimeMs = opts.maxWallTimeMs;
|
|
35950
36032
|
const workspaceRoot = opts.workspaceRoot ?? defaultRunnerWorkspaceRoot();
|
|
35951
|
-
const artifactRoot = opts.artifactRoot ?? (opts.workspaceRoot === void 0 ? defaultRunnerArtifactRoot() : join14(
|
|
36033
|
+
const artifactRoot = opts.artifactRoot ?? (opts.workspaceRoot === void 0 ? defaultRunnerArtifactRoot() : join14(dirname8(workspaceRoot), "run-artifacts"));
|
|
35952
36034
|
const runRegistryRoot2 = opts.runRegistryRoot ?? defaultRunRegistryRoot();
|
|
35953
36035
|
const createArtifacts = opts.createArtifacts ?? createRunArtifacts;
|
|
35954
36036
|
const toolPackRegistry2 = opts.toolPackRegistry ?? createDefaultToolPackRegistry();
|
|
@@ -36033,7 +36115,7 @@ function createCliRunner(adapter, opts = {}) {
|
|
|
36033
36115
|
outcome.ok && outcome.result && typeof outcome.result === "object" ? outcome.result["artifact"] : void 0
|
|
36034
36116
|
);
|
|
36035
36117
|
if (parsed.success) {
|
|
36036
|
-
const candidate =
|
|
36118
|
+
const candidate = resolve10(cwd, path);
|
|
36037
36119
|
const key = await realpath8(candidate).catch(() => candidate);
|
|
36038
36120
|
publishedTaskFiles.set(key, parsed.data);
|
|
36039
36121
|
}
|
|
@@ -36314,8 +36396,8 @@ ${attachmentSection}` : prompt;
|
|
|
36314
36396
|
let changed = false;
|
|
36315
36397
|
for (const path of paths) {
|
|
36316
36398
|
if (!path || path.length > 4096) continue;
|
|
36317
|
-
const absolutePath = isAbsolute14(path) ? path :
|
|
36318
|
-
const directory =
|
|
36399
|
+
const absolutePath = isAbsolute14(path) ? path : resolve10(cwd, path);
|
|
36400
|
+
const directory = dirname8(absolutePath);
|
|
36319
36401
|
observedWorkingDirectories.delete(directory);
|
|
36320
36402
|
observedWorkingDirectories.add(directory);
|
|
36321
36403
|
while (observedWorkingDirectories.size > 19) {
|
|
@@ -36747,7 +36829,7 @@ function runCliProcess(options) {
|
|
|
36747
36829
|
usage: { inputTokens: 0, outputTokens: 0 }
|
|
36748
36830
|
});
|
|
36749
36831
|
}
|
|
36750
|
-
return new Promise((
|
|
36832
|
+
return new Promise((resolve17) => {
|
|
36751
36833
|
const platform = options.platform ?? process.platform;
|
|
36752
36834
|
const containmentGateNonce = options.guardian && platform === "win32" ? randomUUID10() : void 0;
|
|
36753
36835
|
const child = options.guardian ? spawn8(
|
|
@@ -36761,7 +36843,7 @@ function runCliProcess(options) {
|
|
|
36761
36843
|
// The idle pre-assignment guardian must never load from or depend
|
|
36762
36844
|
// on an untrusted Task checkout. Only the post-gate target enters
|
|
36763
36845
|
// the requested working directory from its private release frame.
|
|
36764
|
-
cwd:
|
|
36846
|
+
cwd: dirname8(options.guardian.scriptPath),
|
|
36765
36847
|
env: runnerGuardianEnv(process.env, containmentGateNonce),
|
|
36766
36848
|
stdio: ["pipe", "pipe", "pipe"],
|
|
36767
36849
|
windowsHide: true,
|
|
@@ -36809,7 +36891,7 @@ function runCliProcess(options) {
|
|
|
36809
36891
|
clearInterval(timer);
|
|
36810
36892
|
unregisterFollowUps?.();
|
|
36811
36893
|
parser.stop?.();
|
|
36812
|
-
|
|
36894
|
+
resolve17(result);
|
|
36813
36895
|
};
|
|
36814
36896
|
const terminate = (result) => {
|
|
36815
36897
|
if (settled || forcedResult) return;
|
|
@@ -37042,13 +37124,13 @@ import { randomUUID as randomUUID11 } from "node:crypto";
|
|
|
37042
37124
|
|
|
37043
37125
|
// src/runners/runtime-observation.ts
|
|
37044
37126
|
import { open as open6, readdir as readdir4, realpath as realpath9 } from "node:fs/promises";
|
|
37045
|
-
import { homedir as
|
|
37127
|
+
import { homedir as homedir6 } from "node:os";
|
|
37046
37128
|
import { join as join15 } from "node:path";
|
|
37047
37129
|
var READ_WINDOW_BYTES = 1024 * 1024;
|
|
37048
37130
|
var CATALOG_TIMEOUT_MS = 15e3;
|
|
37049
37131
|
var CATALOG_OUTPUT_LIMIT_BYTES = 4 * 1024 * 1024;
|
|
37050
37132
|
function homeFrom(env) {
|
|
37051
|
-
return env["HOME"] || env["USERPROFILE"] ||
|
|
37133
|
+
return env["HOME"] || env["USERPROFILE"] || homedir6();
|
|
37052
37134
|
}
|
|
37053
37135
|
async function readHead(path) {
|
|
37054
37136
|
let handle;
|
|
@@ -37155,7 +37237,7 @@ async function readCodexSessionRuntime(input) {
|
|
|
37155
37237
|
}
|
|
37156
37238
|
var codexCatalogCache = /* @__PURE__ */ new Map();
|
|
37157
37239
|
async function loadCodexModelCatalog(command, prefixArgs, env) {
|
|
37158
|
-
const output = await new Promise((
|
|
37240
|
+
const output = await new Promise((resolve17) => {
|
|
37159
37241
|
const child = spawnCli(command, [...prefixArgs, "debug", "models"], {
|
|
37160
37242
|
stdio: ["ignore", "pipe", "ignore"],
|
|
37161
37243
|
windowsHide: true,
|
|
@@ -37170,7 +37252,7 @@ async function loadCodexModelCatalog(command, prefixArgs, env) {
|
|
|
37170
37252
|
if (settled) return;
|
|
37171
37253
|
settled = true;
|
|
37172
37254
|
clearTimeout(timer);
|
|
37173
|
-
|
|
37255
|
+
resolve17(value);
|
|
37174
37256
|
};
|
|
37175
37257
|
const timer = setTimeout(() => {
|
|
37176
37258
|
child.kill();
|
|
@@ -37275,8 +37357,8 @@ function createRuntimeReporter(input, sessionId) {
|
|
|
37275
37357
|
var EFFORT_READ_ATTEMPTS = 5;
|
|
37276
37358
|
var EFFORT_READ_INTERVAL_MS = 3e3;
|
|
37277
37359
|
function delay2(ms) {
|
|
37278
|
-
return new Promise((
|
|
37279
|
-
const timer = setTimeout(
|
|
37360
|
+
return new Promise((resolve17) => {
|
|
37361
|
+
const timer = setTimeout(resolve17, ms);
|
|
37280
37362
|
timer.unref?.();
|
|
37281
37363
|
});
|
|
37282
37364
|
}
|
|
@@ -37353,10 +37435,10 @@ function createClaudeLiveParser(onStream, onSessionModel) {
|
|
|
37353
37435
|
},
|
|
37354
37436
|
async steer(followUp) {
|
|
37355
37437
|
if (!write) return false;
|
|
37356
|
-
return await new Promise((
|
|
37357
|
-
acknowledgements.set(followUp.inputId,
|
|
37438
|
+
return await new Promise((resolve17) => {
|
|
37439
|
+
acknowledgements.set(followUp.inputId, resolve17);
|
|
37358
37440
|
void write(input(followUp.inputId, followUp.text)).catch(() => {
|
|
37359
|
-
if (acknowledgements.delete(followUp.inputId))
|
|
37441
|
+
if (acknowledgements.delete(followUp.inputId)) resolve17(false);
|
|
37360
37442
|
});
|
|
37361
37443
|
});
|
|
37362
37444
|
},
|
|
@@ -37518,11 +37600,11 @@ function improveErrorMessage(error52) {
|
|
|
37518
37600
|
// src/runners/codex.ts
|
|
37519
37601
|
import { mkdir as mkdir11, readFile as readFile9, writeFile as writeFile6 } from "node:fs/promises";
|
|
37520
37602
|
import { randomUUID as randomUUID12 } from "node:crypto";
|
|
37521
|
-
import { homedir as
|
|
37603
|
+
import { homedir as homedir7 } from "node:os";
|
|
37522
37604
|
import { join as join16 } from "node:path";
|
|
37523
37605
|
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
37606
|
function defaultCodexThreadIndexRoot() {
|
|
37525
|
-
return join16(
|
|
37607
|
+
return join16(homedir7(), ".zixt", "codex-threads");
|
|
37526
37608
|
}
|
|
37527
37609
|
var SAFE_SEGMENT3 = /^[A-Za-z0-9_-]{1,200}$/;
|
|
37528
37610
|
function threadIndexPath(root, agentId, sessionKey) {
|
|
@@ -37663,8 +37745,8 @@ ${value}` : value;
|
|
|
37663
37745
|
var RUNTIME_READ_ATTEMPTS = 5;
|
|
37664
37746
|
var RUNTIME_READ_INTERVAL_MS = 2e3;
|
|
37665
37747
|
function delay3(ms) {
|
|
37666
|
-
return new Promise((
|
|
37667
|
-
const timer = setTimeout(
|
|
37748
|
+
return new Promise((resolve17) => {
|
|
37749
|
+
const timer = setTimeout(resolve17, ms);
|
|
37668
37750
|
timer.unref?.();
|
|
37669
37751
|
});
|
|
37670
37752
|
}
|
|
@@ -37703,7 +37785,7 @@ function createCodexAppServerParser(onStream, options) {
|
|
|
37703
37785
|
const turnReadyWaiters = /* @__PURE__ */ new Set();
|
|
37704
37786
|
const usage = () => ({ inputTokens, outputTokens });
|
|
37705
37787
|
const settleTurnReadiness = (ready) => {
|
|
37706
|
-
for (const
|
|
37788
|
+
for (const resolve17 of turnReadyWaiters) resolve17(ready);
|
|
37707
37789
|
turnReadyWaiters.clear();
|
|
37708
37790
|
};
|
|
37709
37791
|
const send = async (message) => {
|
|
@@ -37884,12 +37966,12 @@ function createCodexAppServerParser(onStream, options) {
|
|
|
37884
37966
|
async steer(input) {
|
|
37885
37967
|
if (stopped) return false;
|
|
37886
37968
|
if (!activeTurnId) {
|
|
37887
|
-
const ready = await new Promise((
|
|
37969
|
+
const ready = await new Promise((resolve17) => turnReadyWaiters.add(resolve17));
|
|
37888
37970
|
if (!ready || stopped) return false;
|
|
37889
37971
|
}
|
|
37890
37972
|
if (!threadId || !activeTurnId) return false;
|
|
37891
|
-
return await new Promise((
|
|
37892
|
-
steerWaiters.set(input.inputId,
|
|
37973
|
+
return await new Promise((resolve17) => {
|
|
37974
|
+
steerWaiters.set(input.inputId, resolve17);
|
|
37893
37975
|
void send({
|
|
37894
37976
|
id: `steer:${input.inputId}`,
|
|
37895
37977
|
method: "turn/steer",
|
|
@@ -37900,7 +37982,7 @@ function createCodexAppServerParser(onStream, options) {
|
|
|
37900
37982
|
clientUserMessageId: input.inputId
|
|
37901
37983
|
}
|
|
37902
37984
|
}).catch(() => {
|
|
37903
|
-
if (steerWaiters.delete(input.inputId))
|
|
37985
|
+
if (steerWaiters.delete(input.inputId)) resolve17(false);
|
|
37904
37986
|
});
|
|
37905
37987
|
});
|
|
37906
37988
|
},
|
|
@@ -37908,7 +37990,7 @@ function createCodexAppServerParser(onStream, options) {
|
|
|
37908
37990
|
stopped = true;
|
|
37909
37991
|
write = null;
|
|
37910
37992
|
settleTurnReadiness(false);
|
|
37911
|
-
for (const
|
|
37993
|
+
for (const resolve17 of steerWaiters.values()) resolve17(false);
|
|
37912
37994
|
steerWaiters.clear();
|
|
37913
37995
|
},
|
|
37914
37996
|
push(chunk) {
|
|
@@ -38087,7 +38169,7 @@ function improveCodexErrorMessage(error52) {
|
|
|
38087
38169
|
// src/runners/git-preflight.ts
|
|
38088
38170
|
import { spawn as spawn9 } from "node:child_process";
|
|
38089
38171
|
import { realpath as realpath10 } from "node:fs/promises";
|
|
38090
|
-
import { isAbsolute as isAbsolute15, resolve as
|
|
38172
|
+
import { isAbsolute as isAbsolute15, resolve as resolve11 } from "node:path";
|
|
38091
38173
|
var OUTPUT_LIMIT = 8192;
|
|
38092
38174
|
var DEFAULT_TIMEOUT_MS4 = 1e4;
|
|
38093
38175
|
var VERSION_PATTERN = /^git version [^\r\n]{1,108}$/;
|
|
@@ -38106,7 +38188,7 @@ async function preflightGit(options = {}) {
|
|
|
38106
38188
|
if (configured !== void 0 && !isAbsolute15(configured)) {
|
|
38107
38189
|
return unavailable("configured git command must be an absolute file", checkedAt);
|
|
38108
38190
|
}
|
|
38109
|
-
const trustedCwd = await realpath10(
|
|
38191
|
+
const trustedCwd = await realpath10(resolve11(options.trustedCwd ?? process.cwd())).catch(() => null);
|
|
38110
38192
|
if (!trustedCwd)
|
|
38111
38193
|
return unavailable("Host-owned git preflight directory is unavailable", checkedAt);
|
|
38112
38194
|
const executablePath = await resolveTrustedCliCommand(configured ?? "git", {
|
|
@@ -38328,7 +38410,7 @@ function parseAuth(result) {
|
|
|
38328
38410
|
return "unknown";
|
|
38329
38411
|
}
|
|
38330
38412
|
function run2(command, args) {
|
|
38331
|
-
return new Promise((
|
|
38413
|
+
return new Promise((resolve17) => {
|
|
38332
38414
|
const child = spawnCli(command, args, {
|
|
38333
38415
|
stdio: ["ignore", "pipe", "pipe"],
|
|
38334
38416
|
windowsHide: true
|
|
@@ -38344,7 +38426,7 @@ function run2(command, args) {
|
|
|
38344
38426
|
if (settled) return;
|
|
38345
38427
|
settled = true;
|
|
38346
38428
|
clearTimeout(timeout);
|
|
38347
|
-
|
|
38429
|
+
resolve17(result);
|
|
38348
38430
|
};
|
|
38349
38431
|
const timeout = setTimeout(() => {
|
|
38350
38432
|
child.kill();
|
|
@@ -38359,8 +38441,8 @@ function run2(command, args) {
|
|
|
38359
38441
|
import { spawn as spawn10 } from "node:child_process";
|
|
38360
38442
|
import { constants as constants2 } from "node:fs";
|
|
38361
38443
|
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
|
|
38444
|
+
import { homedir as homedir8, userInfo } from "node:os";
|
|
38445
|
+
import { basename as basename4, dirname as dirname9, join as join17, relative as relative9, resolve as resolve12, sep as sep5 } from "node:path";
|
|
38364
38446
|
var SERVICE_NAME = "zixt-host.service";
|
|
38365
38447
|
var SYSTEM_SERVICE_COMMAND_TIMEOUT_MS = 7e4;
|
|
38366
38448
|
var SERVICE_STABILITY_DELAY_MS = 2e3;
|
|
@@ -38388,7 +38470,7 @@ function boundedAppend(current, chunk) {
|
|
|
38388
38470
|
}
|
|
38389
38471
|
async function defaultRunCommand(command, args) {
|
|
38390
38472
|
const commandEnvironment3 = systemServiceCommandEnvironment();
|
|
38391
|
-
return new Promise((
|
|
38473
|
+
return new Promise((resolve17) => {
|
|
38392
38474
|
const child = spawn10(command, [...args], {
|
|
38393
38475
|
stdio: ["ignore", "pipe", "pipe"],
|
|
38394
38476
|
env: commandEnvironment3,
|
|
@@ -38402,7 +38484,7 @@ async function defaultRunCommand(command, args) {
|
|
|
38402
38484
|
if (settled) return;
|
|
38403
38485
|
settled = true;
|
|
38404
38486
|
if (timer) clearTimeout(timer);
|
|
38405
|
-
|
|
38487
|
+
resolve17(result);
|
|
38406
38488
|
};
|
|
38407
38489
|
child.stdout?.on("data", (chunk) => {
|
|
38408
38490
|
stdout = boundedAppend(stdout, chunk);
|
|
@@ -38463,9 +38545,9 @@ async function defaultSyncDirectory(path) {
|
|
|
38463
38545
|
async function ensureDirectory(path, mode, syncDirectory7) {
|
|
38464
38546
|
const firstCreated = await mkdir12(path, { recursive: true, mode });
|
|
38465
38547
|
if (!firstCreated) return;
|
|
38466
|
-
const first =
|
|
38467
|
-
const target =
|
|
38468
|
-
await syncDirectory7(
|
|
38548
|
+
const first = resolve12(firstCreated);
|
|
38549
|
+
const target = resolve12(path);
|
|
38550
|
+
await syncDirectory7(dirname9(first));
|
|
38469
38551
|
let current = first;
|
|
38470
38552
|
const descendants = relative9(first, target);
|
|
38471
38553
|
for (const part of descendants ? descendants.split(sep5) : []) {
|
|
@@ -38474,7 +38556,7 @@ async function ensureDirectory(path, mode, syncDirectory7) {
|
|
|
38474
38556
|
}
|
|
38475
38557
|
}
|
|
38476
38558
|
async function replacePrivateFile(path, contents, mode, syncDirectory7) {
|
|
38477
|
-
const parent =
|
|
38559
|
+
const parent = dirname9(path);
|
|
38478
38560
|
await ensureDirectory(parent, 448, syncDirectory7);
|
|
38479
38561
|
const temporary = join17(parent, `.${basename4(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
|
|
38480
38562
|
const handle = await open7(temporary, "wx", mode);
|
|
@@ -38520,7 +38602,7 @@ async function installLinuxService(options) {
|
|
|
38520
38602
|
throw new Error("Linux automatic startup is available only on Linux.");
|
|
38521
38603
|
}
|
|
38522
38604
|
const env = options.env ?? process.env;
|
|
38523
|
-
const home = options.home ??
|
|
38605
|
+
const home = options.home ?? homedir8();
|
|
38524
38606
|
const username = oneLine(options.username ?? userInfo().username, "user name");
|
|
38525
38607
|
const token2 = oneLine(options.token, "pairing code");
|
|
38526
38608
|
const path = oneLine(
|
|
@@ -38538,7 +38620,7 @@ async function installLinuxService(options) {
|
|
|
38538
38620
|
const resolveCommand = options.resolveCommand ?? defaultResolveCommand;
|
|
38539
38621
|
const run3 = options.runCommand ?? defaultRunCommand;
|
|
38540
38622
|
const syncDirectory7 = options.syncDirectory ?? defaultSyncDirectory;
|
|
38541
|
-
const stabilityDelay = options.delay ?? ((ms) => new Promise((
|
|
38623
|
+
const stabilityDelay = options.delay ?? ((ms) => new Promise((resolve17) => setTimeout(resolve17, ms)));
|
|
38542
38624
|
const [systemctl, loginctl] = await Promise.all([
|
|
38543
38625
|
resolveCommand("systemctl"),
|
|
38544
38626
|
resolveCommand("loginctl")
|
|
@@ -38652,8 +38734,8 @@ async function installLinuxService(options) {
|
|
|
38652
38734
|
import { spawn as spawn11 } from "node:child_process";
|
|
38653
38735
|
import { constants as constants3 } from "node:fs";
|
|
38654
38736
|
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
|
|
38737
|
+
import { homedir as homedir9, userInfo as userInfo2 } from "node:os";
|
|
38738
|
+
import { basename as basename5, dirname as dirname10, join as join18, relative as relative10, resolve as resolve13, sep as sep6 } from "node:path";
|
|
38657
38739
|
var LAUNCH_AGENT_LABEL = "ai.zixt.host";
|
|
38658
38740
|
var SERVICE_STABILITY_DELAY_MS2 = 2e3;
|
|
38659
38741
|
var COMMAND_TIMEOUT_MS2 = 7e4;
|
|
@@ -38679,9 +38761,9 @@ async function syncDirectory4(path) {
|
|
|
38679
38761
|
async function ensureDirectory2(path, sync) {
|
|
38680
38762
|
const firstCreated = await mkdir13(path, { recursive: true, mode: 448 });
|
|
38681
38763
|
if (!firstCreated) return;
|
|
38682
|
-
const first =
|
|
38683
|
-
const target =
|
|
38684
|
-
await sync(
|
|
38764
|
+
const first = resolve13(firstCreated);
|
|
38765
|
+
const target = resolve13(path);
|
|
38766
|
+
await sync(dirname10(first));
|
|
38685
38767
|
let current = first;
|
|
38686
38768
|
for (const part of relative10(first, target).split(sep6).filter(Boolean)) {
|
|
38687
38769
|
await sync(current);
|
|
@@ -38689,7 +38771,7 @@ async function ensureDirectory2(path, sync) {
|
|
|
38689
38771
|
}
|
|
38690
38772
|
}
|
|
38691
38773
|
async function replacePrivateFile2(path, contents, mode, sync) {
|
|
38692
|
-
const parent =
|
|
38774
|
+
const parent = dirname10(path);
|
|
38693
38775
|
await ensureDirectory2(parent, sync);
|
|
38694
38776
|
const temporary = join18(parent, `.${basename5(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
|
|
38695
38777
|
const handle = await open8(temporary, "wx", mode);
|
|
@@ -38779,7 +38861,7 @@ async function installMacosService(options) {
|
|
|
38779
38861
|
throw new Error("macOS automatic startup is available only on macOS.");
|
|
38780
38862
|
}
|
|
38781
38863
|
const env = options.env ?? process.env;
|
|
38782
|
-
const home = options.home ??
|
|
38864
|
+
const home = options.home ?? homedir9();
|
|
38783
38865
|
const uid = options.uid ?? userInfo2().uid;
|
|
38784
38866
|
if (!Number.isSafeInteger(uid) || uid < 0) throw new Error("macOS user id is invalid.");
|
|
38785
38867
|
const token2 = oneLine2(options.token, "pairing code");
|
|
@@ -38883,8 +38965,8 @@ async function installMacosService(options) {
|
|
|
38883
38965
|
import { spawn as spawn12 } from "node:child_process";
|
|
38884
38966
|
import { constants as constants4 } from "node:fs";
|
|
38885
38967
|
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
|
|
38968
|
+
import { homedir as homedir10 } from "node:os";
|
|
38969
|
+
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
38970
|
var TASK_NAME = "Zixt Host";
|
|
38889
38971
|
var COMMAND_TIMEOUT_MS3 = 7e4;
|
|
38890
38972
|
var SERVICE_STABILITY_DELAY_MS3 = 2e3;
|
|
@@ -38912,9 +38994,9 @@ async function syncDirectory5(path) {
|
|
|
38912
38994
|
async function ensureDirectory3(path, sync) {
|
|
38913
38995
|
const firstCreated = await mkdir14(path, { recursive: true, mode: 448 });
|
|
38914
38996
|
if (!firstCreated) return;
|
|
38915
|
-
const first =
|
|
38916
|
-
const target =
|
|
38917
|
-
await sync(
|
|
38997
|
+
const first = resolve14(firstCreated);
|
|
38998
|
+
const target = resolve14(path);
|
|
38999
|
+
await sync(dirname11(first));
|
|
38918
39000
|
let current = first;
|
|
38919
39001
|
for (const part of relative11(first, target).split(sep7).filter(Boolean)) {
|
|
38920
39002
|
await sync(current);
|
|
@@ -38922,7 +39004,7 @@ async function ensureDirectory3(path, sync) {
|
|
|
38922
39004
|
}
|
|
38923
39005
|
}
|
|
38924
39006
|
async function replacePrivateFile3(path, contents, sync) {
|
|
38925
|
-
const parent =
|
|
39007
|
+
const parent = dirname11(path);
|
|
38926
39008
|
await ensureDirectory3(parent, sync);
|
|
38927
39009
|
const temporary = join19(parent, `.${basename6(path)}.${process.pid}.${crypto.randomUUID()}.tmp`);
|
|
38928
39010
|
const handle = await open9(temporary, "wx", 384);
|
|
@@ -39108,7 +39190,7 @@ async function installWindowsService(options) {
|
|
|
39108
39190
|
throw new Error("Windows automatic startup is available only on Windows.");
|
|
39109
39191
|
}
|
|
39110
39192
|
const env = options.env ?? process.env;
|
|
39111
|
-
const home = options.home ??
|
|
39193
|
+
const home = options.home ?? homedir10();
|
|
39112
39194
|
const localAppData = options.localAppData ?? env.LOCALAPPDATA;
|
|
39113
39195
|
if (!localAppData || !isAbsolute16(localAppData)) {
|
|
39114
39196
|
throw new Error("Windows local application data path is unavailable.");
|
|
@@ -39222,15 +39304,15 @@ async function installSystemService(options) {
|
|
|
39222
39304
|
|
|
39223
39305
|
// src/terminal-outcomes.ts
|
|
39224
39306
|
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
|
|
39307
|
+
import { homedir as homedir11 } from "node:os";
|
|
39308
|
+
import { dirname as dirname12, join as join20, relative as relative12, resolve as resolve15, sep as sep8 } from "node:path";
|
|
39227
39309
|
var DIRECTORY_MODE5 = 448;
|
|
39228
39310
|
var FILE_MODE4 = 384;
|
|
39229
39311
|
var MAX_OUTCOME_BYTES = 4 * 1024 * 1024;
|
|
39230
39312
|
var HOST_DIRECTORY = /^hst_[0-9a-f]{32}$/;
|
|
39231
39313
|
var OUTCOME_FILE = /^(tsk_[0-9a-f]{32})\.([1-9][0-9]*)\.json$/;
|
|
39232
39314
|
function defaultTerminalOutcomeRoot() {
|
|
39233
|
-
return join20(
|
|
39315
|
+
return join20(homedir11(), ".zixt", "terminal-outcomes");
|
|
39234
39316
|
}
|
|
39235
39317
|
function hostOutcomeRoot(root, hostId) {
|
|
39236
39318
|
if (!HOST_DIRECTORY.test(hostId)) throw new Error("terminal outcome Host identity is malformed");
|
|
@@ -39251,9 +39333,9 @@ async function syncDirectory6(root) {
|
|
|
39251
39333
|
async function requirePrivateRoot(root, sync = syncDirectory6) {
|
|
39252
39334
|
const firstCreated = await mkdir15(root, { recursive: true, mode: DIRECTORY_MODE5 });
|
|
39253
39335
|
if (firstCreated) {
|
|
39254
|
-
const first =
|
|
39255
|
-
const target =
|
|
39256
|
-
await sync(
|
|
39336
|
+
const first = resolve15(firstCreated);
|
|
39337
|
+
const target = resolve15(root);
|
|
39338
|
+
await sync(dirname12(first));
|
|
39257
39339
|
let current = first;
|
|
39258
39340
|
for (const part of relative12(first, target).split(sep8).filter(Boolean)) {
|
|
39259
39341
|
await sync(current);
|
|
@@ -39503,12 +39585,12 @@ function createHostLogger(options = {}) {
|
|
|
39503
39585
|
}
|
|
39504
39586
|
|
|
39505
39587
|
// src/demo-state.ts
|
|
39506
|
-
import { isAbsolute as isAbsolute17, join as join21, parse as parse3, resolve as
|
|
39588
|
+
import { isAbsolute as isAbsolute17, join as join21, parse as parse3, resolve as resolve16 } from "node:path";
|
|
39507
39589
|
var DEMO_STATE_ROOT_ENV = "ZIXT_DEMO_STATE_ROOT";
|
|
39508
39590
|
function resolveDemoHostStatePaths(env = process.env) {
|
|
39509
39591
|
const configured = env.ZIXT_RUNNER === "demo" ? env[DEMO_STATE_ROOT_ENV] : void 0;
|
|
39510
39592
|
if (!configured) return null;
|
|
39511
|
-
const root =
|
|
39593
|
+
const root = resolve16(configured);
|
|
39512
39594
|
if (!isAbsolute17(configured) || root === parse3(root).root) {
|
|
39513
39595
|
throw new Error(`${DEMO_STATE_ROOT_ENV} must be a dedicated absolute directory`);
|
|
39514
39596
|
}
|
|
@@ -39926,13 +40008,18 @@ async function telemetry() {
|
|
|
39926
40008
|
runners: cachedRunners ?? [],
|
|
39927
40009
|
workspaces: [],
|
|
39928
40010
|
docker: "unknown",
|
|
40011
|
+
// Measured per heartbeat: free memory and free disk are only useful while
|
|
40012
|
+
// they are current, and a demo Host reports its own private root so the
|
|
40013
|
+
// number describes the filesystem its Tasks would really write to.
|
|
40014
|
+
hardware: await machineHardware(runnerWorkspaceRoot ?? homedir12()),
|
|
39929
40015
|
capabilities: {
|
|
39930
40016
|
linearToolPack: providerToolPacks.some(
|
|
39931
40017
|
(pack) => pack.provider === "linear" && pack.health === "ready"
|
|
39932
40018
|
),
|
|
39933
40019
|
providerToolPacks,
|
|
39934
40020
|
browser: await currentBrowserCapability(),
|
|
39935
|
-
...packagedBuild && process.env.ZIXT_HOST_UPDATE !== "off" ? { remoteUpdate: true } : {}
|
|
40021
|
+
...packagedBuild && process.env.ZIXT_HOST_UPDATE !== "off" ? { remoteUpdate: true } : {},
|
|
40022
|
+
hostUpdateMode: packagedBuild ? process.env.ZIXT_HOST_UPDATE === "off" ? "pinned" : "published" : "source"
|
|
39936
40023
|
}
|
|
39937
40024
|
};
|
|
39938
40025
|
}
|