@codetreker/daynight 0.25.2 → 0.26.0
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/README.md +116 -8
- package/config.example.yml +3 -0
- package/dist/api/client.js +2 -2
- package/dist/api/client.js.map +1 -1
- package/dist/api/parse.js +14 -2
- package/dist/api/parse.js.map +1 -1
- package/dist/api/types.d.ts +4 -1
- package/dist/api/worker-mode.d.ts +6 -0
- package/dist/api/worker-mode.js +14 -0
- package/dist/api/worker-mode.js.map +1 -0
- package/dist/cli/commands.js +2 -0
- package/dist/cli/commands.js.map +1 -1
- package/dist/commands/controller/command-controls.d.ts +4 -0
- package/dist/commands/controller/command-controls.js +33 -0
- package/dist/commands/controller/command-controls.js.map +1 -0
- package/dist/commands/controller/definition.d.ts +3 -0
- package/dist/commands/controller/definition.js +22 -0
- package/dist/commands/controller/definition.js.map +1 -0
- package/dist/commands/controller/independent.d.ts +3 -0
- package/dist/commands/controller/independent.js +344 -0
- package/dist/commands/controller/independent.js.map +1 -0
- package/dist/commands/controller/index.d.ts +12 -0
- package/dist/commands/controller/index.js +73 -0
- package/dist/commands/controller/index.js.map +1 -0
- package/dist/commands/controller/launch-ticket.d.ts +49 -0
- package/dist/commands/controller/launch-ticket.js +99 -0
- package/dist/commands/controller/launch-ticket.js.map +1 -0
- package/dist/commands/controller/lifecycle-store.d.ts +84 -0
- package/dist/commands/controller/lifecycle-store.js +278 -0
- package/dist/commands/controller/lifecycle-store.js.map +1 -0
- package/dist/commands/controller/local-client.d.ts +44 -0
- package/dist/commands/controller/local-client.js +75 -0
- package/dist/commands/controller/local-client.js.map +1 -0
- package/dist/commands/controller/local-content.d.ts +23 -0
- package/dist/commands/controller/local-content.js +103 -0
- package/dist/commands/controller/local-content.js.map +1 -0
- package/dist/commands/controller/process-proof.d.ts +13 -0
- package/dist/commands/controller/process-proof.js +121 -0
- package/dist/commands/controller/process-proof.js.map +1 -0
- package/dist/commands/controller/providers/claude.d.ts +2 -0
- package/dist/commands/controller/providers/claude.js +470 -0
- package/dist/commands/controller/providers/claude.js.map +1 -0
- package/dist/commands/controller/providers/codex.d.ts +2 -0
- package/dist/commands/controller/providers/codex.js +254 -0
- package/dist/commands/controller/providers/codex.js.map +1 -0
- package/dist/commands/controller/providers/controls-claude.d.ts +26 -0
- package/dist/commands/controller/providers/controls-claude.js +138 -0
- package/dist/commands/controller/providers/controls-claude.js.map +1 -0
- package/dist/commands/controller/providers/controls-codex.d.ts +38 -0
- package/dist/commands/controller/providers/controls-codex.js +199 -0
- package/dist/commands/controller/providers/controls-codex.js.map +1 -0
- package/dist/commands/controller/providers/controls-copilot.d.ts +20 -0
- package/dist/commands/controller/providers/controls-copilot.js +143 -0
- package/dist/commands/controller/providers/controls-copilot.js.map +1 -0
- package/dist/commands/controller/providers/controls.d.ts +21 -0
- package/dist/commands/controller/providers/controls.js +53 -0
- package/dist/commands/controller/providers/controls.js.map +1 -0
- package/dist/commands/controller/providers/copilot-interactions.d.ts +47 -0
- package/dist/commands/controller/providers/copilot-interactions.js +295 -0
- package/dist/commands/controller/providers/copilot-interactions.js.map +1 -0
- package/dist/commands/controller/providers/copilot-projection.d.ts +11 -0
- package/dist/commands/controller/providers/copilot-projection.js +93 -0
- package/dist/commands/controller/providers/copilot-projection.js.map +1 -0
- package/dist/commands/controller/providers/copilot-runtime.d.ts +9 -0
- package/dist/commands/controller/providers/copilot-runtime.js +127 -0
- package/dist/commands/controller/providers/copilot-runtime.js.map +1 -0
- package/dist/commands/controller/providers/copilot.d.ts +2 -0
- package/dist/commands/controller/providers/copilot.js +309 -0
- package/dist/commands/controller/providers/copilot.js.map +1 -0
- package/dist/commands/controller/providers/interactions.d.ts +3 -0
- package/dist/commands/controller/providers/interactions.js +79 -0
- package/dist/commands/controller/providers/interactions.js.map +1 -0
- package/dist/commands/controller/providers/native-rpc.d.ts +28 -0
- package/dist/commands/controller/providers/native-rpc.js +85 -0
- package/dist/commands/controller/providers/native-rpc.js.map +1 -0
- package/dist/commands/controller/providers/projection.d.ts +23 -0
- package/dist/commands/controller/providers/projection.js +99 -0
- package/dist/commands/controller/providers/projection.js.map +1 -0
- package/dist/commands/controller/providers/turns.d.ts +7 -0
- package/dist/commands/controller/providers/turns.js +21 -0
- package/dist/commands/controller/providers/turns.js.map +1 -0
- package/dist/commands/controller/providers/types.d.ts +44 -0
- package/dist/commands/controller/providers/types.js +2 -0
- package/dist/commands/controller/providers/types.js.map +1 -0
- package/dist/commands/controller/recovery.d.ts +6 -0
- package/dist/commands/controller/recovery.js +22 -0
- package/dist/commands/controller/recovery.js.map +1 -0
- package/dist/commands/controller/relay.d.ts +18 -0
- package/dist/commands/controller/relay.js +299 -0
- package/dist/commands/controller/relay.js.map +1 -0
- package/dist/commands/controller/resume.d.ts +18 -0
- package/dist/commands/controller/resume.js +193 -0
- package/dist/commands/controller/resume.js.map +1 -0
- package/dist/commands/controller/runtime.d.ts +5 -0
- package/dist/commands/controller/runtime.js +455 -0
- package/dist/commands/controller/runtime.js.map +1 -0
- package/dist/commands/controller/windows-job.d.ts +3 -0
- package/dist/commands/controller/windows-job.js +59 -0
- package/dist/commands/controller/windows-job.js.map +1 -0
- package/dist/commands/controller/wire-display.d.ts +5 -0
- package/dist/commands/controller/wire-display.js +11 -0
- package/dist/commands/controller/wire-display.js.map +1 -0
- package/dist/commands/skill/skills/using-daynight/SKILL.md +24 -20
- package/dist/commands/skill/skills/using-daynight/references/autopilot-managed-task.md +16 -10
- package/dist/commands/skill/skills/using-daynight/references/create-task.md +40 -39
- package/dist/commands/skill/skills/using-daynight/references/goal.md +40 -29
- package/dist/commands/skill/skills/using-daynight/references/handbook.md +4 -3
- package/dist/commands/skill/skills/using-daynight/references/handoff.md +3 -0
- package/dist/commands/skill/skills/using-daynight/references/run-task.md +3 -3
- package/dist/commands/skill/skills/using-daynight/references/task-content.md +96 -51
- package/dist/commands/skill/skills/using-daynight/references/task-execution.md +28 -22
- package/dist/commands/worker/backend.d.ts +7 -0
- package/dist/commands/worker/backend.js +7 -0
- package/dist/commands/worker/backend.js.map +1 -0
- package/dist/commands/worker/backends/grant-renewal.d.ts +13 -0
- package/dist/commands/worker/backends/grant-renewal.js +42 -0
- package/dist/commands/worker/backends/grant-renewal.js.map +1 -0
- package/dist/commands/worker/backends/session-api.d.ts +66 -0
- package/dist/commands/worker/backends/session-api.js +84 -0
- package/dist/commands/worker/backends/session-api.js.map +1 -0
- package/dist/commands/worker/backends/web-process.d.ts +79 -0
- package/dist/commands/worker/backends/web-process.js +156 -0
- package/dist/commands/worker/backends/web-process.js.map +1 -0
- package/dist/commands/worker/backends/web-store.d.ts +49 -0
- package/dist/commands/worker/backends/web-store.js +323 -0
- package/dist/commands/worker/backends/web-store.js.map +1 -0
- package/dist/commands/worker/backends/web-types.d.ts +83 -0
- package/dist/commands/worker/backends/web-types.js +3 -0
- package/dist/commands/worker/backends/web-types.js.map +1 -0
- package/dist/commands/worker/backends/web.d.ts +26 -0
- package/dist/commands/worker/backends/web.js +178 -0
- package/dist/commands/worker/backends/web.js.map +1 -0
- package/dist/commands/worker/config.js +12 -5
- package/dist/commands/worker/config.js.map +1 -1
- package/dist/commands/worker/control.d.ts +2 -0
- package/dist/commands/worker/control.js +11 -4
- package/dist/commands/worker/control.js.map +1 -1
- package/dist/commands/worker/coordinator.d.ts +7 -0
- package/dist/commands/worker/coordinator.js +138 -19
- package/dist/commands/worker/coordinator.js.map +1 -1
- package/dist/commands/worker/herdr/agents.js +11 -8
- package/dist/commands/worker/herdr/agents.js.map +1 -1
- package/dist/commands/worker/herdr/arguments.js +10 -5
- package/dist/commands/worker/herdr/arguments.js.map +1 -1
- package/dist/commands/worker/herdr/claude-input.d.ts +2 -0
- package/dist/commands/worker/herdr/claude-input.js +20 -0
- package/dist/commands/worker/herdr/claude-input.js.map +1 -0
- package/dist/commands/worker/herdr/instance.js +1 -1
- package/dist/commands/worker/herdr/instance.js.map +1 -1
- package/dist/commands/worker/herdr/preflight.d.ts +1 -1
- package/dist/commands/worker/herdr/preflight.js +31 -10
- package/dist/commands/worker/herdr/preflight.js.map +1 -1
- package/dist/commands/worker/herdr.js +5 -1
- package/dist/commands/worker/herdr.js.map +1 -1
- package/dist/commands/worker/prompts.js +5 -1
- package/dist/commands/worker/prompts.js.map +1 -1
- package/dist/commands/worker/repositories.js +2 -2
- package/dist/commands/worker/repositories.js.map +1 -1
- package/dist/commands/worker/runtime.js +62 -10
- package/dist/commands/worker/runtime.js.map +1 -1
- package/dist/commands/worker/setup-environment.d.ts +2 -1
- package/dist/commands/worker/setup-environment.js +10 -4
- package/dist/commands/worker/setup-environment.js.map +1 -1
- package/dist/commands/worker/setup.js +5 -5
- package/dist/commands/worker/setup.js.map +1 -1
- package/dist/commands/worker/store.d.ts +2 -1
- package/dist/commands/worker/store.js +19 -9
- package/dist/commands/worker/store.js.map +1 -1
- package/dist/commands/worker/types.d.ts +4 -1
- package/dist/commands/worker/worktrees.js +9 -6
- package/dist/commands/worker/worktrees.js.map +1 -1
- package/dist/session/controller-protocol.d.ts +245 -0
- package/dist/session/controller-protocol.js +218 -0
- package/dist/session/controller-protocol.js.map +1 -0
- package/dist/session/controls.d.ts +28 -0
- package/dist/session/controls.js +37 -0
- package/dist/session/controls.js.map +1 -0
- package/dist/session/protocol.d.ts +290 -0
- package/dist/session/protocol.js +307 -0
- package/dist/session/protocol.js.map +1 -0
- package/package.json +7 -2
|
@@ -1,52 +1,88 @@
|
|
|
1
1
|
# Task content standard
|
|
2
2
|
|
|
3
3
|
Read this reference when creating, breaking down, handing off, or executing a
|
|
4
|
-
task.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
task. The description and its readable references must explain the task without
|
|
5
|
+
the originating chat, memory, private worktree, or temporary files. Use the
|
|
6
|
+
target repository's document and language rules.
|
|
7
|
+
|
|
8
|
+
## Task and session boundary
|
|
9
|
+
|
|
10
|
+
Tasks describe what must be achieved and delivered. Sessions hold how the task
|
|
11
|
+
is executed or discussed. Keep task definitions, required inputs, deliverables,
|
|
12
|
+
acceptance criteria, and resulting artifacts in task content. Keep execution and
|
|
13
|
+
discussion plans, steps, tool choices, collaboration, operational authorization,
|
|
14
|
+
progress, blockers, and recovery context in the session. Apply this boundary to
|
|
15
|
+
descriptions, attachments, and referenced task material.
|
|
16
|
+
|
|
17
|
+
A design supplied as a required input or produced as the task's deliverable is
|
|
18
|
+
task content; the session's plan for producing that deliverable is session
|
|
19
|
+
context. Classify information by its purpose, not its filename or words such as
|
|
20
|
+
"plan", "method", or "steps". A requested migration design, test strategy, or
|
|
21
|
+
runbook can be a task deliverable. Do not invent such a deliverable to upload a
|
|
22
|
+
session checkpoint or execution log.
|
|
23
|
+
|
|
24
|
+
| Information | Location |
|
|
25
|
+
|---|---|
|
|
26
|
+
| Required sorting behavior; an upstream API contract; a design task's current architecture | Task definition, input, or result |
|
|
27
|
+
| "Register only; do not execute or enable agents in this session"; chosen commands, agent assignments, review rounds | Session context; current operations still obey its restrictions |
|
|
28
|
+
| Required deliverable platform or compatibility threshold; a human-confirmation completion condition | Task scope or acceptance criteria |
|
|
29
|
+
| Authorization to push or merge; CI/review progress, waiting items, claim/worktree/head and next action | Session context or the corresponding platform |
|
|
30
|
+
| A final deliverable's immutable revision; an acceptance conclusion and the key observations needed to support it | Task result, without the execution history |
|
|
8
31
|
|
|
9
|
-
|
|
10
|
-
|
|
32
|
+
Operational authorization does not become task content because another session
|
|
33
|
+
might need it. Preserve it in the host's session state or existing local
|
|
34
|
+
checkpoint. Missing authorization or assignment cannot be reconstructed from a
|
|
35
|
+
task's description, attachments, acceptance state, or status.
|
|
11
36
|
|
|
12
|
-
##
|
|
37
|
+
## Task definition and results
|
|
13
38
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
39
|
+
Provide the following substantive information in the description, clearly
|
|
40
|
+
referenced documents, or a mixture of both. These are not mandatory headings.
|
|
41
|
+
Complete inline content needs no primary attachment; do not duplicate complete
|
|
42
|
+
documents or keep empty template sections.
|
|
18
43
|
|
|
19
|
-
|
|
|
44
|
+
| Definition | Required information |
|
|
20
45
|
|---|---|
|
|
21
46
|
| Objective and requirements | The concrete problem, intended outcome, and required behavior. Use requirement IDs when they help acceptance. |
|
|
22
|
-
| Scope and
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
| Acceptance criteria
|
|
26
|
-
|
|
47
|
+
| Scope and constraints | This task's responsibility and delivery boundaries, including constraints on the product or deliverable and applicable parts of shared documents. |
|
|
48
|
+
| Inputs and sources | Actual required requirements, designs, prototypes, protocols, or deliveries, with accurate source identities, applicable sections, and purpose. |
|
|
49
|
+
| Deliverables and contracts | Expected outputs, delivery and reading locations, and the structure and semantics needed by actual producers or consumers. Explicitly say when there is no task-to-task exchange. |
|
|
50
|
+
| Acceptance criteria | Observable completion conditions, applicable success/failure/boundary behavior, required thresholds, and any human-confirmation gate. |
|
|
51
|
+
|
|
52
|
+
Save results as they are produced: current reviewable requirements or designs,
|
|
53
|
+
actual deliverables, acceptance conclusions, defects, and material limitations.
|
|
54
|
+
An immutable revision or verified resource location may identify a result.
|
|
55
|
+
Keep the accepted content and its effective state, not successive discussion or
|
|
56
|
+
confirmation records. Acceptance results may include the assessed source and
|
|
57
|
+
key observations needed to understand the conclusion; commands, debugging
|
|
58
|
+
history, CI logs, and review handling remain execution context.
|
|
59
|
+
|
|
60
|
+
A task does not universally require a separate solution, implementation plan,
|
|
61
|
+
verification procedure, confirmation record, or evidence location. Its starting
|
|
62
|
+
content depends on the stage and actual inputs. Do not require unfinished
|
|
63
|
+
results or prefilled result sections at registration.
|
|
27
64
|
|
|
28
65
|
The description must identify the concrete current work and responsibility and
|
|
29
66
|
make its content sources discoverable. Judge completeness from the description
|
|
30
67
|
and the contents actually read, not heading presence or whether the description
|
|
31
68
|
repeats the documents. A bare generic problem plus unexplained links, "see the
|
|
32
|
-
previous discussion", unreadable resources, and missing decisions are
|
|
69
|
+
previous discussion", unreadable resources, and missing required decisions are
|
|
70
|
+
insufficient. Absence of a session execution plan is not a task-content gap.
|
|
33
71
|
|
|
34
|
-
## Content ownership
|
|
72
|
+
## Content ownership
|
|
35
73
|
|
|
36
74
|
Each detailed explanation has one owner: the description, a referenced task
|
|
37
75
|
attachment, or its actual shared source. Keep shared requirements, architecture,
|
|
38
|
-
and protocols at their owning task.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
verified. A simple maintenance task can instead state the approach, contract,
|
|
49
|
-
acceptance, and evidence location inline.
|
|
76
|
+
and protocols at their owning task. Save this task's results at their actual
|
|
77
|
+
owner and make them discoverable from its description. Rewrite the owning
|
|
78
|
+
material coherently when its facts change; do not accumulate an execution log.
|
|
79
|
+
|
|
80
|
+
For example, an upload retry task may define its required behavior and
|
|
81
|
+
acceptance inline and reference the architecture task's `design/upload.md` for
|
|
82
|
+
shared interfaces. A design task may own that architecture in its description
|
|
83
|
+
or an actual attachment. Neither needs an attachment containing the session's
|
|
84
|
+
implementation steps. Those source identities and paths must be real and
|
|
85
|
+
verified.
|
|
50
86
|
|
|
51
87
|
## Resolve and read sources
|
|
52
88
|
|
|
@@ -58,13 +94,13 @@ owning task ID and content location: its description and applicable sections for
|
|
|
58
94
|
inline content, or the complete attachment path for an actual attachment. Name
|
|
59
95
|
the whole description when all of it applies; sections only delimit a larger
|
|
60
96
|
source and do not require invented headings. Read source task descriptions with
|
|
61
|
-
`task show --json`; list and read attachment
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
97
|
+
`task show --json`; list and read attachment contents separately with the
|
|
98
|
+
installed attachment commands. Repository documents need accurate paths and the
|
|
99
|
+
required verified immutable source revision. State the sections, requirements,
|
|
100
|
+
or interfaces applicable to this task when a source covers more. Do not invent
|
|
101
|
+
an attachment path for inline content, relocate or copy it merely to satisfy a
|
|
102
|
+
reference format, or invent a URL scheme, cross-task relative link, or fixed
|
|
103
|
+
service host.
|
|
68
104
|
|
|
69
105
|
Read the required source contents, including further references needed for the
|
|
70
106
|
current stage. Track already-read resource identities to avoid circular reading.
|
|
@@ -102,19 +138,22 @@ Necessary direct prerequisites remain in the complete `dependsOn` set and its
|
|
|
102
138
|
[the handbook's dependency reduction rule](handbook.md#dependency-reduction).
|
|
103
139
|
Contract source identities do not form a second complete dependency list, and a
|
|
104
140
|
source reference does not create an execution dependency. Use
|
|
105
|
-
[the handbook](handbook.md) for relationship semantics.
|
|
141
|
+
[the handbook](handbook.md) for relationship semantics. Existing status, PR,
|
|
142
|
+
permission, platform, and worker fields keep their own service semantics; do not
|
|
143
|
+
copy them into prose as a second operational record.
|
|
106
144
|
|
|
107
145
|
## Apply the current stage
|
|
108
146
|
|
|
109
|
-
| Stage | Sufficient starting content | Stage
|
|
147
|
+
| Stage | Sufficient starting content | Stage results |
|
|
110
148
|
|---|---|---|
|
|
111
|
-
| Requirements discussion | Known problem, outcome, scope, open questions, and
|
|
112
|
-
| Solution or architecture discussion | Confirmed requirements, applicable prototype, design questions, and
|
|
113
|
-
| Implementation or document delivery | Defined requirements and scope,
|
|
114
|
-
| Independent final acceptance | Whole agreed requirements and confirmed changes, actual deliveries and
|
|
149
|
+
| Requirements discussion | Known problem, outcome, scope, constraints, open requirements questions, and completion conditions | Current and confirmed requirements and applicable prototype |
|
|
150
|
+
| Solution or architecture discussion | Confirmed requirements, applicable prototype, design questions, intended deliverables, and completion conditions | Current architecture, key decisions, and delivery breakdown |
|
|
151
|
+
| Implementation or document delivery | Defined requirements and scope, required design and applicable prototype, contracts, deliverables, and acceptance criteria | The scoped deliverable and its actual location or version |
|
|
152
|
+
| Independent final acceptance | Whole agreed requirements and confirmed changes, actual deliveries, and acceptance criteria | Requirement-based conclusions, defects, and unverified items |
|
|
115
153
|
|
|
116
154
|
A stage's unfinished outputs are not prerequisites for starting that stage.
|
|
117
|
-
Preserve human confirmation as an actual completion condition where required
|
|
155
|
+
Preserve human confirmation as an actual completion condition where required;
|
|
156
|
+
the execution protocol handles the confirmation action and advancement.
|
|
118
157
|
Explicit prerequisite-produced implementation outputs may still be pending when
|
|
119
158
|
preparing a blocked task, provided the necessary design and agreed interfaces
|
|
120
159
|
already define the successor's work. Do not label future output as an existing
|
|
@@ -122,12 +161,18 @@ readable input. Execution still waits for real prerequisites and required inputs
|
|
|
122
161
|
|
|
123
162
|
## Check sufficiency
|
|
124
163
|
|
|
125
|
-
Before reporting creation, breakdown, or handoff ready, check
|
|
126
|
-
source readability and applicability,
|
|
127
|
-
stage's additional conditions.
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
164
|
+
Before reporting creation, breakdown, or handoff ready, check the task
|
|
165
|
+
definition, source readability and applicability, existing result ownership, and
|
|
166
|
+
the stage's additional conditions. Check both directions: session context stays
|
|
167
|
+
out, and actual requirements, required design inputs, and task results remain
|
|
168
|
+
complete. Unknown requirements, design choices, acceptance thresholds, and
|
|
169
|
+
interface decisions are concrete blockers, not details to invent. Only organize
|
|
170
|
+
confirmed information within existing authorization. A material scope or
|
|
171
|
+
behavior change requires user confirmation.
|
|
172
|
+
|
|
173
|
+
Apply the boundary when reading existing material and when authoring or
|
|
174
|
+
rewriting authorized task content. It does not authorize bulk edits of historical
|
|
175
|
+
tasks or automatic changes to fields, permissions, or recorded history.
|
|
131
176
|
|
|
132
177
|
Task versions protect task metadata, not independently mutable attachments or
|
|
133
178
|
cross-task references. Verify mutable contents before enabling permission and
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
# Shared task execution
|
|
2
2
|
|
|
3
3
|
Read this reference after the selected execution mode establishes the task's
|
|
4
|
-
identity. It owns required inputs, authorized work, delivery,
|
|
4
|
+
identity. It owns required inputs, authorized work, delivery, results, and
|
|
5
5
|
acceptance readiness. The execution mode owns starting or resuming the task,
|
|
6
6
|
its final status operation, and returning to its caller.
|
|
7
7
|
|
|
8
8
|
## Read the task and stage inputs
|
|
9
9
|
|
|
10
10
|
Read the complete task and its actual required references under
|
|
11
|
-
[the task content standard](task-content.md), including the
|
|
12
|
-
criteria, and
|
|
13
|
-
description must identify the concrete current work, responsibility,
|
|
14
|
-
sources. Complete inline content needs no primary attachment;
|
|
15
|
-
and mixed organization are valid when their combined contents
|
|
16
|
-
|
|
11
|
+
[the task content standard](task-content.md), including the task definition,
|
|
12
|
+
actual required design inputs, acceptance criteria, and existing results. Its
|
|
13
|
+
Markdown description must identify the concrete current work, responsibility,
|
|
14
|
+
and content sources. Complete inline content needs no primary attachment;
|
|
15
|
+
document-owned and mixed organization are valid when their combined contents
|
|
16
|
+
provide the stage-appropriate task definition. A missing session execution plan
|
|
17
|
+
is not a missing task input.
|
|
17
18
|
|
|
18
19
|
Resolve description-relative links and images from the current task's attachment
|
|
19
20
|
root; links inside a Markdown attachment use its own directory. Resolve real
|
|
@@ -65,8 +66,9 @@ apply the shared rule to verification methods, temporary helpers, and result
|
|
|
65
66
|
ownership.
|
|
66
67
|
|
|
67
68
|
Follow the target repository's instructions for worktrees, implementation,
|
|
68
|
-
review, validation, and delivery. Use the task's
|
|
69
|
+
review, validation, and delivery. Use the task's required design inputs and
|
|
69
70
|
acceptance criteria, including applicable final-style prototype interactions.
|
|
71
|
+
Keep the implementation or discussion plan in the session.
|
|
70
72
|
Requirements discussion defines the problem without architecture decisions or
|
|
71
73
|
production implementation. Solution discussion keeps its draft architecture and
|
|
72
74
|
breakdown in its owning task. Preserve the Goal's user-confirmation gates:
|
|
@@ -78,24 +80,27 @@ Resolve material changes to the agreed solution or acceptance within the current
|
|
|
78
80
|
authorization. Rewrite the owning artifact and affected task summaries and input
|
|
79
81
|
references coherently. Preserve requirements; do not silently weaken acceptance.
|
|
80
82
|
Descriptions remain self-contained Markdown task summaries. Preserve valid
|
|
81
|
-
syntax,
|
|
82
|
-
updates; confirm new or replaced resources before linking them.
|
|
83
|
+
syntax, required task content, and actual resource references during full-field
|
|
84
|
+
updates; confirm new or replaced resources before linking them. Apply the content
|
|
85
|
+
boundary to authorized rewrites without modifying unrelated historical tasks.
|
|
86
|
+
Dependency edits
|
|
83
87
|
must follow the handbook's CLI replacement contract: read full D/E, retain needed
|
|
84
88
|
ordinary D−E and external E declarations, submit their intended complete sets
|
|
85
89
|
with the observed version, and read back both. Omit all dependency options for
|
|
86
|
-
unrelated metadata updates. Keep detailed content
|
|
87
|
-
|
|
88
|
-
remain at their verified source.
|
|
90
|
+
unrelated metadata updates. Keep detailed task content and produced results at
|
|
91
|
+
their identified owners; shared inputs remain at their verified source.
|
|
89
92
|
|
|
90
93
|
Advance only this task. Subagents collaborate on it, and waiting for CI, review,
|
|
91
94
|
approval, or merge remains part of it. Keep all required delivery PR URLs and
|
|
92
95
|
titles in the complete `properties.pullRequests` list, preserving existing
|
|
93
|
-
entries.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
entries. Save actual task results and acceptance conclusions at their owners.
|
|
97
|
+
Use verified artifact locations or immutable revisions when needed to identify
|
|
98
|
+
the final deliverable. Rewrite current results coherently rather than
|
|
99
|
+
accumulating an execution log. Keep operational authorization, implementation
|
|
100
|
+
steps, CI/review/merge handling, progress, blockers, waiting items, and next
|
|
101
|
+
action in the conversation or existing execution checkpoint, retaining the task
|
|
102
|
+
ID and needed PR and workspace references. Recover authorization and assignment
|
|
103
|
+
from that session context, not task material or status.
|
|
99
104
|
|
|
100
105
|
## Confirm acceptance readiness
|
|
101
106
|
|
|
@@ -122,9 +127,10 @@ completion pending and successors blocked.
|
|
|
122
127
|
|
|
123
128
|
For tasks without a development or PR delivery path, use their stated stage
|
|
124
129
|
acceptance. For [final acceptance](../SKILL.md#final-acceptance), also apply the
|
|
125
|
-
shared whole-task or whole-Goal completion rule. In every case, confirm
|
|
126
|
-
|
|
127
|
-
|
|
130
|
+
shared whole-task or whole-Goal completion rule. In every case, confirm the
|
|
131
|
+
required deliverables and acceptance conclusions are readable before returning
|
|
132
|
+
to the execution mode's completion operation; retain operational verification
|
|
133
|
+
in the session. Discussion completion establishes that stage's accepted
|
|
128
134
|
output; it does not establish whole-Goal completion.
|
|
129
135
|
|
|
130
136
|
## Preserve waiting context
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AgentControlMode, WorkerAgent } from "../../api/types.js";
|
|
2
|
+
/** Validate effective arguments before a claim can create native execution responsibility. */
|
|
3
|
+
export declare const requireImplementedWorkerBackend: (configuration: {
|
|
4
|
+
agent: WorkerAgent;
|
|
5
|
+
agentControlMode?: AgentControlMode;
|
|
6
|
+
args?: readonly string[];
|
|
7
|
+
} | null) => void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { parseProviderArguments } from "../controller/providers/projection.js";
|
|
2
|
+
/** Validate effective arguments before a claim can create native execution responsibility. */
|
|
3
|
+
export const requireImplementedWorkerBackend = (configuration) => {
|
|
4
|
+
if (configuration?.agentControlMode === "web" && configuration.args !== undefined)
|
|
5
|
+
parseProviderArguments(configuration.agent, configuration.args);
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=backend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend.js","sourceRoot":"","sources":["../../../src/commands/worker/backend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAG/E,8FAA8F;AAC9F,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,aAA2G,EAAQ,EAAE;IACnK,IAAI,aAAa,EAAE,gBAAgB,KAAK,KAAK,IAAI,aAAa,CAAC,IAAI,KAAK,SAAS;QAAE,sBAAsB,CAAC,aAAa,CAAC,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;AACrJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { readLaunchTicket } from "../../controller/launch-ticket.js";
|
|
2
|
+
import type { WebExecutionStore } from "./web-store.js";
|
|
3
|
+
import type { createWebControllerLauncher } from "./web-process.js";
|
|
4
|
+
/** Keep native channels authorized independently of claim-discovery polling. */
|
|
5
|
+
export declare const maintainWorkerControllerGrants: (options: {
|
|
6
|
+
homeDirectory: string;
|
|
7
|
+
serverOrigin: string;
|
|
8
|
+
store: Pick<WebExecutionStore, "listUnfinishedTasks">;
|
|
9
|
+
launcher: Pick<ReturnType<typeof createWebControllerLauncher>, "refreshGrant">;
|
|
10
|
+
signal: AbortSignal;
|
|
11
|
+
onError(message: string): void;
|
|
12
|
+
readTicket?: typeof readLaunchTicket;
|
|
13
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
2
|
+
import { readLaunchTicket } from "../../controller/launch-ticket.js";
|
|
3
|
+
/** Keep native channels authorized independently of claim-discovery polling. */
|
|
4
|
+
export const maintainWorkerControllerGrants = async (options) => {
|
|
5
|
+
const readTicket = options.readTicket ?? readLaunchTicket;
|
|
6
|
+
const failures = new Map();
|
|
7
|
+
while (!options.signal.aborted) {
|
|
8
|
+
const renewals = await Promise.allSettled(options.store.listUnfinishedTasks().map(async (task) => {
|
|
9
|
+
if (options.signal.aborted)
|
|
10
|
+
return;
|
|
11
|
+
const execution = task.webExecution;
|
|
12
|
+
if (task.serverOrigin !== options.serverOrigin || !execution?.ticketPath || execution.launchSubmission === "not-submitted" || task.cleanup?.agentStopped)
|
|
13
|
+
return;
|
|
14
|
+
try {
|
|
15
|
+
const ticket = await readTicket(options.homeDirectory, execution.launchId);
|
|
16
|
+
if (ticket.executionId !== execution.executionId || ticket.executionGeneration !== execution.executionGeneration || ticket.controllerInstanceId !== execution.controllerInstanceId || ticket.claimId !== task.claimId)
|
|
17
|
+
throw new Error("Controller credential renewal has conflicting execution evidence.");
|
|
18
|
+
await options.launcher.refreshGrant(task, ticket, options.signal);
|
|
19
|
+
failures.delete(execution.executionId);
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
if (options.signal.aborted)
|
|
23
|
+
return;
|
|
24
|
+
const message = error instanceof Error ? error.message : "Controller credential renewal failed.";
|
|
25
|
+
if (failures.get(execution.executionId) !== message)
|
|
26
|
+
options.onError(message);
|
|
27
|
+
failures.set(execution.executionId, message);
|
|
28
|
+
}
|
|
29
|
+
}));
|
|
30
|
+
const rejected = renewals.filter(result => result.status === "rejected");
|
|
31
|
+
if (rejected.length > 0)
|
|
32
|
+
throw new AggregateError(rejected.map(result => result.reason), "Controller credential renewal could not finish safely.");
|
|
33
|
+
try {
|
|
34
|
+
await delay(30_000, undefined, { signal: options.signal });
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
if (!options.signal.aborted)
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=grant-renewal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grant-renewal.js","sourceRoot":"","sources":["../../../../src/commands/worker/backends/grant-renewal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAIrE,gFAAgF;AAChF,MAAM,CAAC,MAAM,8BAA8B,GAAG,KAAK,EAAE,OAKpD,EAAiB,EAAE;IAClB,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,gBAAgB,CAAC;IAC1D,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC3C,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QAC/B,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC,GAAG,CAAC,KAAK,EAAC,IAAI,EAAC,EAAE;YAC7F,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO;gBAAE,OAAO;YACnC,MAAM,SAAS,GAAG,IAAI,CAAC,Y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AAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC;QACzE,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;YAAE,MAAM,IAAI,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,wDAAwD,CAAC,CAAC;QACnJ,IAAI,CAAC;YAAC,MAAM,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAAC,CAAC;QACnE,OAAO,KAAK,EAAE,CAAC;YAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO;gBAAE,MAAM,KAAK,CAAC;QAAC,CAAC;IAC7D,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { SESSION_PROTOCOL } from "../../../session/protocol.js";
|
|
2
|
+
import { type ControllerGrantResponse } from "../../../session/controller-protocol.js";
|
|
3
|
+
import type { LocalTask, WebExecutionState } from "./web-types.js";
|
|
4
|
+
export declare const createWorkerSessionApi: (serverOrigin: string, serverToken: string) => {
|
|
5
|
+
verifyUnregistered: (identity: {
|
|
6
|
+
projectId: string;
|
|
7
|
+
taskId: string;
|
|
8
|
+
claimId: string;
|
|
9
|
+
}, signal: AbortSignal) => Promise<void>;
|
|
10
|
+
verifySupport: (provider: string, signal: AbortSignal) => Promise<void>;
|
|
11
|
+
register: (task: LocalTask, execution: WebExecutionState, signal: AbortSignal) => Promise<{
|
|
12
|
+
readonly claimId: string;
|
|
13
|
+
readonly testExecutionId?: never;
|
|
14
|
+
} & {
|
|
15
|
+
readonly sessionId: string;
|
|
16
|
+
readonly executionGeneration: import("../../../session/protocol.js").DecimalSequence;
|
|
17
|
+
} & {
|
|
18
|
+
readonly connectionEpoch: import("../../../session/protocol.js").DecimalSequence;
|
|
19
|
+
} & {
|
|
20
|
+
readonly controls?: import("../../../session/controls.js").SessionControls;
|
|
21
|
+
readonly turnStartedAt?: string | null;
|
|
22
|
+
readonly protocol: typeof SESSION_PROTOCOL;
|
|
23
|
+
readonly schemaVersion: typeof import("../../../session/protocol.js").SESSION_SCHEMA_VERSION;
|
|
24
|
+
readonly projectionVersion: typeof import("../../../session/protocol.js").SESSION_PROJECTION_VERSION;
|
|
25
|
+
readonly identity: ({
|
|
26
|
+
readonly projectId: string;
|
|
27
|
+
readonly taskId: string;
|
|
28
|
+
readonly workerId: string;
|
|
29
|
+
readonly worktreeId: string;
|
|
30
|
+
readonly ownerUserId?: never;
|
|
31
|
+
} | {
|
|
32
|
+
readonly ownerUserId: string;
|
|
33
|
+
readonly projectId?: never;
|
|
34
|
+
readonly taskId?: never;
|
|
35
|
+
readonly workerId?: never;
|
|
36
|
+
readonly worktreeId?: never;
|
|
37
|
+
}) & {
|
|
38
|
+
readonly controllerId: string;
|
|
39
|
+
readonly controllerInstanceId: string;
|
|
40
|
+
readonly agentControlMode: "web";
|
|
41
|
+
readonly provider: import("../../../session/protocol.js").SessionProvider;
|
|
42
|
+
readonly nativeSessionId: string | null;
|
|
43
|
+
};
|
|
44
|
+
readonly sessionRevision: import("../../../session/protocol.js").DecimalSequence;
|
|
45
|
+
readonly historyEpoch: string;
|
|
46
|
+
readonly lastEventSeq: import("../../../session/protocol.js").DecimalSequence;
|
|
47
|
+
readonly lastTimelineSeq: import("../../../session/protocol.js").DecimalSequence;
|
|
48
|
+
readonly initialInputState: import("../../../session/protocol.js").InitialInputState;
|
|
49
|
+
readonly synchronized: boolean;
|
|
50
|
+
readonly lifecycle: "active" | "draining" | "archived";
|
|
51
|
+
readonly connectionState: "connected" | "disconnected" | "synchronizing";
|
|
52
|
+
readonly activity: "initializing" | "idle" | "working" | "waiting_input" | "stopped" | "unknown";
|
|
53
|
+
readonly currentTurnId: string | null;
|
|
54
|
+
readonly capabilities: import("../../../session/protocol.js").SessionCapabilities;
|
|
55
|
+
readonly operations: import("../../../session/protocol.js").SessionOperations;
|
|
56
|
+
readonly cleanupInteractionIds?: readonly string[];
|
|
57
|
+
}>;
|
|
58
|
+
grant: (task: LocalTask, execution: WebExecutionState, signal: AbortSignal, previous?: {
|
|
59
|
+
generation: string;
|
|
60
|
+
instanceId: string;
|
|
61
|
+
recordId: string;
|
|
62
|
+
stoppedAt: string;
|
|
63
|
+
}) => Promise<ControllerGrantResponse>;
|
|
64
|
+
};
|
|
65
|
+
export declare const writeControllerCredential: (filename: string, grant: ControllerGrantResponse) => Promise<void>;
|
|
66
|
+
export type WorkerSessionApi = ReturnType<typeof createWorkerSessionApi>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { chmod, mkdir, rename, writeFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
4
|
+
import { SESSION_PROTOCOL } from "../../../session/protocol.js";
|
|
5
|
+
import { parseRegistrationResponse, parseControllerGrantResponse, parseCurrentSessionResponse } from "../../../session/controller-protocol.js";
|
|
6
|
+
export const createWorkerSessionApi = (serverOrigin, serverToken) => {
|
|
7
|
+
const request = async (target, body, signal, method = "POST") => {
|
|
8
|
+
const response = await fetch(`${serverOrigin}${target}`, { method, headers: { authorization: `Bearer ${serverToken}`, "content-type": "application/json" }, ...(body === undefined ? {} : { body: JSON.stringify(body) }), signal: AbortSignal.any([signal, AbortSignal.timeout(30000)]) });
|
|
9
|
+
const chunks = [];
|
|
10
|
+
let size = 0;
|
|
11
|
+
if (response.body !== null) {
|
|
12
|
+
const reader = response.body.getReader();
|
|
13
|
+
try {
|
|
14
|
+
while (true) {
|
|
15
|
+
const { done, value } = await reader.read();
|
|
16
|
+
if (done)
|
|
17
|
+
break;
|
|
18
|
+
size += value.byteLength;
|
|
19
|
+
if (size > 2 * 1024 * 1024) {
|
|
20
|
+
await reader.cancel();
|
|
21
|
+
throw new Error("Session registration response exceeds its limit.");
|
|
22
|
+
}
|
|
23
|
+
chunks.push(value);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
finally {
|
|
27
|
+
reader.releaseLock();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const raw = Buffer.concat(chunks).toString("utf8");
|
|
31
|
+
if (!response.ok)
|
|
32
|
+
throw new Error(`Session registration failed with HTTP ${response.status}; read back the original registration before replacing its identity.`);
|
|
33
|
+
try {
|
|
34
|
+
return JSON.parse(raw);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
throw new Error("Session registration returned invalid JSON; the result is unconfirmed.");
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const prefix = (task) => `/api/v1/projects/${task.projectId}/tasks/${task.taskId}/sessions`;
|
|
41
|
+
return {
|
|
42
|
+
verifyUnregistered: async (identity, signal) => {
|
|
43
|
+
const result = parseCurrentSessionResponse(await request(`/api/v1/projects/${identity.projectId}/tasks/${identity.taskId}/sessions/current`, undefined, signal, "GET"));
|
|
44
|
+
if (result.status !== "not_registered" || result.claimId !== identity.claimId)
|
|
45
|
+
throw new Error("The original Web launch provenance is missing; an existing or superseded Session cannot be recreated or deleted. Restore its execution evidence.");
|
|
46
|
+
},
|
|
47
|
+
verifySupport: async (provider, signal) => {
|
|
48
|
+
const response = await fetch(`${serverOrigin}/api/v1/session-capabilities`, { headers: { authorization: `Bearer ${serverToken}` }, signal: AbortSignal.any([signal, AbortSignal.timeout(10000)]) });
|
|
49
|
+
if (!response.ok)
|
|
50
|
+
throw new Error("This service has not confirmed Web session protocol support; no claim was submitted.");
|
|
51
|
+
const value = await response.json();
|
|
52
|
+
if (value.protocol !== SESSION_PROTOCOL || value.schemaVersion !== 1 || value.projectionVersion !== 1 || !Array.isArray(value.providers) || !value.providers.includes(provider))
|
|
53
|
+
throw new Error("The service Web session protocol or provider is incompatible; no claim was submitted.");
|
|
54
|
+
},
|
|
55
|
+
register: async (task, execution, signal) => {
|
|
56
|
+
if (task.configuration?.agentControlMode !== "web")
|
|
57
|
+
throw new Error("Session registration requires a supported web execution.");
|
|
58
|
+
const input = { protocol: SESSION_PROTOCOL, registrationId: execution.registrationId, claimId: task.claimId, workerId: task.workerId, worktreeId: task.worktreeId, provider: task.configuration.agent, controllerId: execution.controllerId, controllerInstanceId: execution.controllerInstanceId };
|
|
59
|
+
const result = parseRegistrationResponse(await request(prefix(task), input, signal));
|
|
60
|
+
const session = result.session;
|
|
61
|
+
if (session.claimId !== task.claimId || session.identity.taskId !== task.taskId || session.identity.projectId !== task.projectId || session.identity.workerId !== task.workerId || session.identity.worktreeId !== task.worktreeId || session.identity.provider !== task.configuration.agent || session.identity.controllerId !== execution.controllerId || session.identity.controllerInstanceId !== execution.controllerInstanceId)
|
|
62
|
+
throw new Error("Registered session does not match the frozen execution.");
|
|
63
|
+
return session;
|
|
64
|
+
},
|
|
65
|
+
grant: async (task, execution, signal, previous) => {
|
|
66
|
+
if (execution.sessionId === null)
|
|
67
|
+
throw new Error("Controller authorization requires its registered session.");
|
|
68
|
+
const input = { protocol: SESSION_PROTOCOL, claimId: task.claimId, controllerId: execution.controllerId, controllerInstanceId: execution.controllerInstanceId, executionGeneration: execution.executionGeneration, kind: execution.launchSubmission === "not-submitted" ? "bootstrap" : "reconnect", previousGeneration: previous?.generation ?? null, stopProof: previous === undefined ? null : { recordId: previous.recordId, previousControllerInstanceId: previous.instanceId, stoppedAt: previous.stoppedAt } };
|
|
69
|
+
const grant = parseControllerGrantResponse(await request(`${prefix(task)}/${execution.sessionId}/controller-grant`, input, signal));
|
|
70
|
+
if (grant.sessionId !== execution.sessionId || grant.claimId !== task.claimId || grant.executionGeneration !== execution.executionGeneration || grant.controllerId !== execution.controllerId || grant.controllerInstanceId !== execution.controllerInstanceId)
|
|
71
|
+
throw new Error("Controller grant does not match the frozen execution.");
|
|
72
|
+
return grant;
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
export const writeControllerCredential = async (filename, grant) => {
|
|
77
|
+
await mkdir(path.dirname(filename), { recursive: true, mode: 0o700 });
|
|
78
|
+
await chmod(path.dirname(filename), 0o700);
|
|
79
|
+
const temporary = `${filename}.${randomUUID()}.tmp`;
|
|
80
|
+
await writeFile(temporary, `${JSON.stringify(grant)}\n`, { flag: "wx", mode: 0o600 });
|
|
81
|
+
await rename(temporary, filename);
|
|
82
|
+
await chmod(filename, 0o600);
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=session-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-api.js","sourceRoot":"","sources":["../../../../src/commands/worker/backends/session-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,4BAA4B,EAAE,2BAA2B,EAAuF,MAAM,yCAAyC,CAAC;AAEpO,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,YAAoB,EAAE,WAAmB,EAAE,EAAE;IAClF,MAAM,OAAO,GAAG,KAAK,EAAE,MAAc,EAAE,IAAa,EAAE,MAAmB,EAAE,MAAM,GAAG,MAAM,EAAoB,EAAE;QAC9G,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,YAAY,GAAG,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,WAAW,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,EAAE,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,MA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