@yaks/machine 0.0.0-stage → 0.2.36
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/LICENSE +202 -0
- package/README.md +243 -2
- package/_dist/comp.d.ts +5 -0
- package/_dist/comp.d.ts.map +1 -0
- package/_dist/connectors.d.ts +29 -0
- package/_dist/connectors.d.ts.map +1 -0
- package/_dist/effects.d.ts +5 -0
- package/_dist/effects.d.ts.map +1 -0
- package/_dist/execution.d.ts +6 -0
- package/_dist/execution.d.ts.map +1 -0
- package/_dist/graph.d.ts +4 -0
- package/_dist/graph.d.ts.map +1 -0
- package/_dist/mod.d.ts +12 -0
- package/_dist/mod.d.ts.map +1 -0
- package/_dist/recorded.d.ts +4 -0
- package/_dist/recorded.d.ts.map +1 -0
- package/_dist/room.d.ts +45 -0
- package/_dist/room.d.ts.map +1 -0
- package/_dist/targets.d.ts +27 -0
- package/_dist/targets.d.ts.map +1 -0
- package/_dist/tools.d.ts +51 -0
- package/_dist/tools.d.ts.map +1 -0
- package/_dist/vocab.d.ts +5 -0
- package/_dist/vocab.d.ts.map +1 -0
- package/_dist/workspace.d.ts +64 -0
- package/_dist/workspace.d.ts.map +1 -0
- package/_dist/workspaces.d.ts +10 -0
- package/_dist/workspaces.d.ts.map +1 -0
- package/comp.js +3 -0
- package/comp.js.map +1 -0
- package/comp.ts +3 -0
- package/connectors.js +149 -0
- package/connectors.js.map +1 -0
- package/connectors.ts +221 -0
- package/deno.json +1 -0
- package/effect-vocab.json +40 -0
- package/effects.js +71 -0
- package/effects.js.map +1 -0
- package/effects.ts +93 -0
- package/execution.js +239 -0
- package/execution.js.map +1 -0
- package/execution.ts +264 -0
- package/graph.js +70 -0
- package/graph.js.map +1 -0
- package/graph.ts +60 -0
- package/mod.js +5 -0
- package/mod.js.map +1 -0
- package/mod.ts +20 -0
- package/package.json +62 -4
- package/recorded.js +108 -0
- package/recorded.js.map +1 -0
- package/recorded.ts +74 -0
- package/room.js +160 -0
- package/room.js.map +1 -0
- package/room.ts +228 -0
- package/targets.js +127 -0
- package/targets.js.map +1 -0
- package/targets.ts +137 -0
- package/tools.js +346 -0
- package/tools.js.map +1 -0
- package/tools.ts +444 -0
- package/vocab.js +17 -0
- package/vocab.js.map +1 -0
- package/vocab.json +69 -0
- package/vocab.ts +13 -0
- package/workspace.js +79 -0
- package/workspace.js.map +1 -0
- package/workspace.ts +181 -0
- package/workspaces.js +38 -0
- package/workspaces.js.map +1 -0
- package/workspaces.ts +49 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 Jeff Peterson
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,244 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Machines
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Computers, explicit connection transports and durable file-and-command
|
|
4
|
+
workspaces, separate from sandbox provisioning.
|
|
5
|
+
|
|
6
|
+
A **machine** is an actual computer, with a stable graph identity and optional
|
|
7
|
+
`machine.address` selecting a configured connector. A **connector** reaches an
|
|
8
|
+
existing computer; it does not create, destroy or allocate one. A **workspace**
|
|
9
|
+
is the filesystem target of file and command operations, not the location of an
|
|
10
|
+
agent. Its root is a default directory, not an access boundary.
|
|
11
|
+
|
|
12
|
+
## Connect a computer
|
|
13
|
+
|
|
14
|
+
The `./connectors` export supplies `localConnector`, `sshConnector`,
|
|
15
|
+
`pveConnector` and `computer` for explicit scheme selection. Unconfigured or
|
|
16
|
+
unreachable addresses fail rather than falling back to local execution.
|
|
17
|
+
Connection addresses contain no directory or credential. A machine keeps its
|
|
18
|
+
minted identity when its address changes; `computerIdentity` reads the target's
|
|
19
|
+
OS identity for reconciliation, without deriving graph identity from it.
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { equal } from '@yaks/testing'
|
|
23
|
+
import { localConnector } from '@yaks/machine/connectors'
|
|
24
|
+
|
|
25
|
+
// A configured control runner is replaceable, without changing selection.
|
|
26
|
+
let transport = await localConnector(() => Promise.resolve('connected'))
|
|
27
|
+
.connect('local://')
|
|
28
|
+
equal(await transport.execute('printf connected'), 'connected')
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
SSH accepts `ssh://[user@]host[:port]`. It uses batch mode, a connection timeout
|
|
32
|
+
and strict host-key verification. Optional `identity` pins a key and bypasses
|
|
33
|
+
the agent; `knownHosts` selects an explicitly trusted known-host file. It does
|
|
34
|
+
not provision trust or change the remote host's SSH configuration.
|
|
35
|
+
|
|
36
|
+
PVE addresses are `pve://node/qemu/VMID`, reaching a Linux QEMU guest with its
|
|
37
|
+
guest agent enabled. The Proxmox host and LXC guests require SSH, not the guest
|
|
38
|
+
agent API. `pveRequest({endpoint, token})` makes HTTPS API calls; `token()`
|
|
39
|
+
resolves a vault-backed `user@realm!tokenid=secret` value per call, never from
|
|
40
|
+
the address. Supply a scoped token with the guest-agent execution permission.
|
|
41
|
+
The API executes short control scripts, observes their returned PID, and refuses
|
|
42
|
+
failures or truncated output. The long-running command has a separate durable
|
|
43
|
+
receipt inside the guest. It needs neither an API call nor a live caller for its
|
|
44
|
+
lifetime.
|
|
45
|
+
|
|
46
|
+
This API example needs a configured HTTPS endpoint and credential resolver:
|
|
47
|
+
|
|
48
|
+
```ts ignore
|
|
49
|
+
import { pveConnector, pveRequest } from '@yaks/machine/connectors'
|
|
50
|
+
let transport = await pveConnector({
|
|
51
|
+
request: pveRequest({
|
|
52
|
+
endpoint: 'https://pve.example:8006',
|
|
53
|
+
token: async () => await resolveConfiguredCredential(),
|
|
54
|
+
}),
|
|
55
|
+
}).connect('pve://node/qemu/201')
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Durable execution
|
|
59
|
+
|
|
60
|
+
`executionWorkspace(graph, transport, {workspace, root, receipts})`, exported at
|
|
61
|
+
`./execution`, binds file and command operations to a concrete target. `root`
|
|
62
|
+
and `receipts` are absolute target paths, and `workspace` is the graph entity
|
|
63
|
+
id. No implicit placement or host-relative directory is accepted.
|
|
64
|
+
|
|
65
|
+
A call-derived process entity records `process{workspace, command, cwd, pid}`;
|
|
66
|
+
its eid is the handle returned by `start`, `receipt`, `look`, `tail` and `kill`.
|
|
67
|
+
The launch filesystem retains a private receipt, output and exit observation.
|
|
68
|
+
Recreating the connector and workspace recovers them without relaunching the
|
|
69
|
+
command. Concurrent starts of one call serialize at the target; conflicting
|
|
70
|
+
command or cwd arguments are refused. A crash in the ambiguous interval between
|
|
71
|
+
claim and launch leaves a receipt to inspect, not permission to run again. Local
|
|
72
|
+
@yaks/process recovery leaves these workspace-qualified runs alone.
|
|
73
|
+
|
|
74
|
+
`read`, `write` and `stat` are one control script each and start no command.
|
|
75
|
+
`stat(paths)` says what each path names once its links are followed (`file`,
|
|
76
|
+
`directory`, `other`, `missing`, or `dangling` for a link to nothing) and its
|
|
77
|
+
canonical path; finding a session's instruction files is two of them. Every
|
|
78
|
+
workspace answers `stat`, and `shellStat(execute)` gives one to any computer
|
|
79
|
+
that runs bash scripts.
|
|
80
|
+
|
|
81
|
+
The target needs Linux `/proc`, bash, setsid, flock, base64 and ordinary file
|
|
82
|
+
utilities. On a systemd computer, launches require its user manager and enter an
|
|
83
|
+
independent scope through `@yaks/process/isolate`; stopping the launcher's unit
|
|
84
|
+
leaves the command, output and exit receipt intact. Failure to enter the scope
|
|
85
|
+
fails the launch rather than keeping it in the launcher's unit. The detached
|
|
86
|
+
supervisor has its own process group. Stop checks both its boot id and process
|
|
87
|
+
birth token before signalling that group, never an unrelated reused PID. If the
|
|
88
|
+
supervisor dies without writing an exit code, `look` records an unknown exit,
|
|
89
|
+
not an invented success. No connector reaps or sweeps user receipts; deletion
|
|
90
|
+
belongs to explicit resource disposal.
|
|
91
|
+
|
|
92
|
+
A target's optional `limits` are systemd properties each command's scope
|
|
93
|
+
carries, such as `['MemoryMax=6G', 'MemorySwapMax=0']`: a command that grows
|
|
94
|
+
past its cap is the one the kernel ends, not its neighbours. `output(id, from)`
|
|
95
|
+
answers the bytes a command printed from byte `from` on, and
|
|
96
|
+
`follow(workspace,
|
|
97
|
+
id, write)`, exported at `@yaks/machine`, hands `write` each
|
|
98
|
+
new stretch as it appears and answers the process once it ends: a terminal's
|
|
99
|
+
view of a command on another computer. It looks as `settle` does, but at most a
|
|
100
|
+
second apart, and again at once after output, so a run's last words arrive
|
|
101
|
+
within a second of its end.
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
import { equal } from '@yaks/testing'
|
|
105
|
+
import { graph, mint } from '@yaks/graph'
|
|
106
|
+
import { ram } from '@yaks/ram'
|
|
107
|
+
import { loadVocab } from '@yaks/vocab'
|
|
108
|
+
import { processDoc } from '@yaks/process'
|
|
109
|
+
import { executionWorkspace } from '@yaks/machine/execution'
|
|
110
|
+
|
|
111
|
+
let vocab = loadVocab([processDoc])
|
|
112
|
+
let g = graph({ storage: ram(vocab), vocab })
|
|
113
|
+
let workspace = executionWorkspace(g, {
|
|
114
|
+
execute: () => Promise.resolve(''),
|
|
115
|
+
}, { workspace: mint(), root: '/repo', receipts: '/receipts' })
|
|
116
|
+
// A receipt lookup does not execute anything on the computer.
|
|
117
|
+
equal(await workspace.receipt!(mint()), undefined)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Room
|
|
121
|
+
|
|
122
|
+
`@yaks/machine/room` says whether a machine has room for one more run.
|
|
123
|
+
`room(transport)` reads memory pressure (PSI `some avg10`) from the cgroup mount
|
|
124
|
+
root or `/proc/pressure/memory`, CPU wait (PSI `some avg60`) from the cgroup
|
|
125
|
+
root or `/proc/pressure/cpu`, and available bytes from `/proc/meminfo`. Disk I/O
|
|
126
|
+
pressure uses the higher reading from the cgroup root and `/proc/pressure/io`.
|
|
127
|
+
Without `MemAvailable`, `roomOf` estimates from free memory and cache, or from
|
|
128
|
+
the cgroup limit and usage when meminfo reports only the total. `managedRoom()`
|
|
129
|
+
also reads the limits and pressure where systemd starts a managed run.
|
|
130
|
+
`reserving(read, need)` reports the room left after reserving memory for recent
|
|
131
|
+
starts. `admitter(read, need)` answers, one call at a time, whether a run may
|
|
132
|
+
start now. Memory, CPU and I/O pressure must be within their limits. The memory
|
|
133
|
+
available after recent reservations must cover `need.memory`. `here()` supplies
|
|
134
|
+
the admitter for the computer the process runs on.
|
|
135
|
+
|
|
136
|
+
## Exports
|
|
137
|
+
|
|
138
|
+
| Export | What it owns |
|
|
139
|
+
| -------------------------- | ------------------------------------------------ |
|
|
140
|
+
| `@yaks/machine` | Workspace and transport contracts, `settle` |
|
|
141
|
+
| `@yaks/machine/connectors` | Explicit local and SSH computer connections |
|
|
142
|
+
| `@yaks/machine/execution` | Durable command receipts and file operations |
|
|
143
|
+
| `@yaks/machine/targets` | Workspace target resolution and session defaults |
|
|
144
|
+
| `@yaks/machine/workspaces` | Recorded placement to configured connection |
|
|
145
|
+
| `@yaks/machine/tools` | File-and-command tools over workspaces |
|
|
146
|
+
| `@yaks/machine/graph` | Workspace placement and home validation |
|
|
147
|
+
| `@yaks/machine/room` | A machine's free memory and pressure, admission |
|
|
148
|
+
| `@yaks/machine/vocab` | Computer and workspace vocabulary |
|
|
149
|
+
|
|
150
|
+
## Workspace records
|
|
151
|
+
|
|
152
|
+
A workspace is recorded as `workspace{machine, root, sandbox}`. `machine` names
|
|
153
|
+
the actual computer; `root` is its default absolute directory, not an access
|
|
154
|
+
boundary. Optional `sandbox` names an enclosing [sandbox](../sandbox). A sandbox
|
|
155
|
+
entity itself wears `workspace{machine, root}` without a self reference. Missing
|
|
156
|
+
placement means unknown, never the graph server's disk. Resource placement stays
|
|
157
|
+
fixed so old calls remain recoverable after a session changes its default
|
|
158
|
+
target.
|
|
159
|
+
|
|
160
|
+
Session defaults use `home{workspace, cwd}`; a process can retain its original
|
|
161
|
+
`process.workspace`, and a Git repository can name its filesystem context with
|
|
162
|
+
`repository.workspace`. Sandbox provisioning belongs to
|
|
163
|
+
[@yaks/sandbox](../sandbox/README.md). A computer is recorded as
|
|
164
|
+
`machine{address}`; a directory is a workspace, not a computer. Session defaults
|
|
165
|
+
and resource disposal are independent: changing `home.workspace` does not move
|
|
166
|
+
files, stop commands or dispose a sandbox.
|
|
167
|
+
|
|
168
|
+
## Workspace tools and session defaults
|
|
169
|
+
|
|
170
|
+
`@yaks/machine/tools` supplies `workspaceTools(graph, workspaces)`: `shell`,
|
|
171
|
+
`read` and `write` accept an explicit `workspace` and absolute `cwd`, or use
|
|
172
|
+
`home{workspace, cwd}`. An explicit workspace uses its own root unless the call
|
|
173
|
+
also supplies cwd. Relative file paths use that directory; absolute paths remain
|
|
174
|
+
absolute. A default is not a permission boundary.
|
|
175
|
+
|
|
176
|
+
Each invocation records its resolved workspace and cwd in `call.args` before
|
|
177
|
+
executing. Shell recovery uses that record. `wait` and `stop` follow the process
|
|
178
|
+
entity's `process.workspace`, even after its session selects another home.
|
|
179
|
+
Missing or unreachable targets refuse rather than execute on the graph server.
|
|
180
|
+
|
|
181
|
+
`shell`, `wait` and `stop` wait on a process with `settle`, exported at
|
|
182
|
+
`@yaks/machine`. It looks again after the machine's `poll` (100 ms unless the
|
|
183
|
+
machine says otherwise), then half again as long each time, up to two seconds
|
|
184
|
+
apart. An execution workspace takes its transport's `poll`: the local computer's
|
|
185
|
+
is 5 ms, since a look there is one shell, not a network round trip. A short
|
|
186
|
+
command answers within a fraction of a second; a call waiting on a long one
|
|
187
|
+
costs a look every two seconds. An abort ends only the wait, never the command.
|
|
188
|
+
|
|
189
|
+
A process's `exit` is written by a look, so a run whose wait ended first (a
|
|
190
|
+
timeout, an abort, the waiting process gone) keeps none until something looks
|
|
191
|
+
again. `overdue(graph, workspaces, failed?)`, exported at
|
|
192
|
+
`@yaks/machine/targets`, looks once at every workspace process with no `exit`,
|
|
193
|
+
skipping a workspace that refuses to connect and passing any other failure to
|
|
194
|
+
`failed`. The `yak` worker runs it on start and every hour (@yaks/host `bury`).
|
|
195
|
+
|
|
196
|
+
`@yaks/machine/targets` exports `sessionHome(graph, session, workspace, cwd?)`.
|
|
197
|
+
It validates the target and performs a guarded home write; omitting cwd clears
|
|
198
|
+
the old cwd. The harness offers this as `session_home`. A direct graph write can
|
|
199
|
+
set the same home. The machine graph facet validates home targets and absolute
|
|
200
|
+
directories for both doors, and refuses changes to workspace placement.
|
|
201
|
+
|
|
202
|
+
`@yaks/machine/workspaces` supplies `workspaces(graph, bindings)`, connecting
|
|
203
|
+
workspace records through explicitly configured connectors. A sandbox connector
|
|
204
|
+
is supplied by its host; this package neither provisions nor disposes resources.
|
|
205
|
+
|
|
206
|
+
```ts
|
|
207
|
+
import { equal } from '@yaks/testing'
|
|
208
|
+
import { graph, mint } from '@yaks/graph'
|
|
209
|
+
import { ram } from '@yaks/ram'
|
|
210
|
+
import { loadVocab } from '@yaks/vocab'
|
|
211
|
+
import { machineDoc } from '@yaks/machine/vocab'
|
|
212
|
+
import { workspaces } from '@yaks/machine/workspaces'
|
|
213
|
+
|
|
214
|
+
let vocab = loadVocab([machineDoc])
|
|
215
|
+
let g = graph({ storage: ram(vocab), vocab })
|
|
216
|
+
let id = mint()
|
|
217
|
+
await g.apply([{ entity: { eid: id }, workspace: { root: '/repo' } }])
|
|
218
|
+
// Unknown computer placement is not a request to execute locally.
|
|
219
|
+
let refused = false
|
|
220
|
+
try {
|
|
221
|
+
await workspaces(g, { connectors: {}, receipts: '/receipts' }).connect(id)
|
|
222
|
+
} catch {
|
|
223
|
+
refused = true
|
|
224
|
+
}
|
|
225
|
+
equal(refused, true)
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
A CLI host enables connectors explicitly in its config:
|
|
229
|
+
|
|
230
|
+
```json
|
|
231
|
+
{
|
|
232
|
+
"workspaces": {
|
|
233
|
+
"connectors": {
|
|
234
|
+
"local": { "use": "@yaks/machine/local" },
|
|
235
|
+
"ssh": { "use": "@yaks/machine/ssh" }
|
|
236
|
+
},
|
|
237
|
+
"receipts": "/var/lib/yak/receipts"
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
The receipts directory is interpreted on the target computer. Other connector
|
|
243
|
+
modules export `connector(options)`. The host supplies credentials through its
|
|
244
|
+
configured bindings, not through resource addresses.
|
package/_dist/comp.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comp.d.ts","sources":["../comp.ts"],"names":[],"mappings":"AACA,OAAO,YAAI,gBAAmB;AAC9B,YAAY;EAAkB,UAAU,MAAM"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ComputerConnector, ComputerTransport } from "./workspace.js";
|
|
2
|
+
import { quote } from "./workspace.js";
|
|
3
|
+
/** A checked short control command, also the injectable SSH test seam. */ export type ControlRunner = (command: string, args: string[], input: string) => Promise<string>;
|
|
4
|
+
/** Run a bounded control command; managed user commands are detached elsewhere. */ export declare let control: ControlRunner;
|
|
5
|
+
/** Reach this computer only when explicitly addressed as local://. */ export declare let localConnector: (run?: ControlRunner) => ComputerConnector;
|
|
6
|
+
/** SSH uses the operator's known-host policy; it never disables verification.
|
|
7
|
+
* An identity file may be explicitly pinned without consulting a shared agent. */ export declare let sshConnector: (options?: {
|
|
8
|
+
identity?: string;
|
|
9
|
+
knownHosts?: string;
|
|
10
|
+
run?: ControlRunner;
|
|
11
|
+
}) => ComputerConnector;
|
|
12
|
+
/** Request through a configured API binding. Authentication is supplied at
|
|
13
|
+
* invocation, never stored in an address or a process receipt. */ export type PveRequest = (method: 'GET' | 'POST', path: string, values?: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
14
|
+
/** HTTPS API transport with a fresh vault-resolved token on each request. */ export declare let pveRequest: (options: {
|
|
15
|
+
endpoint: string;
|
|
16
|
+
token: () => Promise<string>;
|
|
17
|
+
fetch?: typeof fetch;
|
|
18
|
+
}) => PveRequest;
|
|
19
|
+
/** Reach a Linux QEMU guest through the PVE guest agent. LXC and the PVE host
|
|
20
|
+
* have no guest-agent exec door: reach those computers with SSH instead. */ export declare let pveConnector: (options: {
|
|
21
|
+
request: PveRequest;
|
|
22
|
+
pause?: () => Promise<void>;
|
|
23
|
+
attempts?: number;
|
|
24
|
+
}) => ComputerConnector;
|
|
25
|
+
/** Select only a configured scheme, without an implicit local default. */ export declare let computer: (address: string | undefined, configured: Record<string, ComputerConnector>) => Promise<ComputerTransport>;
|
|
26
|
+
/** A diagnostic script that reads OS identity, not a directory-derived id.
|
|
27
|
+
* The caller reconciles this observation with a minted computer entity. */ export declare let computerIdentity: (transport: ComputerTransport) => Promise<string>;
|
|
28
|
+
/** Export the shell quoting used by connectors for downstream adapters. */ export { quote };
|
|
29
|
+
//# sourceMappingURL=connectors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectors.d.ts","sources":["../connectors.ts"],"names":[],"mappings":"AAIA,cAAc,iBAAiB,EAAE,iBAAiB,yBAAwB;AAC1E,SAAS,KAAK,yBAAwB;AAEtC,wEAAwE,GACxE,YAAY,iBACV,SAAS,MAAM,EACf,MAAM,MAAM,IACZ,OAAO,MAAM,KACV,QAAQ,MAAM;AAEnB,iFAAiF,GACjF,OAAO,YAAI,SAAS,cAmBnB;AAED,oEAAoE,GACpE,OAAO,YAAI,iBACT,MAAK,kBACJ,kBAYD;AAEF;gFACgF,GAChF,OAAO,YAAI,eAAgB;EACzB,WAAW,MAAM;EACjB,aAAa,MAAM;EACnB,MAAM;MACC,kBA8CP;AAEF;gEACgE,GAChE,YAAY,cACV,QAAQ,QAAQ,QAChB,MAAM,MAAM,EACZ,SAAS,OAAO,MAAM,EAAE,OAAO,MAC5B,QAAQ,OAAO,MAAM,EAAE,OAAO;AAEnC,2EAA2E,GAC3E,OAAO,YAAI,aAAc;EACvB,UAAU,MAAM;EAChB,aAAa,QAAQ,MAAM;EAC3B,eAAe;MACb,WAgCH;AAED;0EAC0E,GAC1E,OAAO,YAAI,eAAgB;EACzB,SAAS;EACT,cAAc,QAAQ,IAAI;EAC1B,WAAW,MAAM;MACf,kBAsCF;AAEF,wEAAwE,GACxE,OAAO,YAAI,WACT,SAAS,MAAM,GAAG,SAAS,EAC3B,YAAY,OAAO,MAAM,EAAE,uBAC1B,QAAQ,mBAQV;AAED;yEACyE,GACzE,OAAO,YAAI,mBAAoB,WAAW,sBAAoB,QAAQ,MAAM,EACA;AAE5E,yEAAyE,GACzE,SAAS,KAAK,GAAE"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Operation } from "@yaks/effects/invocation";
|
|
2
|
+
import type { Actor, Eid, Graph } from "@yaks/graph";
|
|
3
|
+
import { type Workspace } from "./workspace.js";
|
|
4
|
+
/** Machine effects over the host's workspace capability. */ export declare let workspaceEffects: (g: Graph, use: <T>(id: Eid, actor: Actor | undefined, run: (workspace: Workspace) => Promise<T>) => Promise<T>) => Record<string, Operation>;
|
|
5
|
+
//# sourceMappingURL=effects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"effects.d.ts","sources":["../effects.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,wCAA6C;AACpE,cAAc,KAAK,EAAQ,GAAG,EAAE,KAAK,2BAAgC;AAGrE,SAAmB,KAAK,SAAS,yBAAwB;AAqCzD,0DAA0D,GAC1D,OAAO,YAAI,mBACT,GAAG,OACH,MAAM,GACJ,IAAI,KACJ,OAAO,QAAQ,SAAS,EACxB,MAAM,WAAW,cAAc,QAAQ,OACpC,QAAQ,OACZ,OAAO,MAAM,EAAE,WA0Cf"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Graph } from "@yaks/graph";
|
|
2
|
+
import { type ComputerTransport, type Workspace, type WorkspaceTarget } from "./workspace.js";
|
|
3
|
+
/** Bind a concrete workspace to an explicitly connected Linux computer.
|
|
4
|
+
* bash, setsid, flock, base64 and /proc are required at the target. No default
|
|
5
|
+
* computer or caller-relative receipt directory is inferred. */ export declare let executionWorkspace: (g: Graph, transport: ComputerTransport, target: WorkspaceTarget) => Workspace & Pick<Required<Workspace>, 'output'>;
|
|
6
|
+
//# sourceMappingURL=execution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution.d.ts","sources":["../execution.ts"],"names":[],"mappings":"AAIA,cAAoB,KAAK,2BAAgC;AAGzD,SACE,KAAK,iBAAiB,EAKtB,KAAK,SAAS,EACd,KAAK,eAAe,yBACC;AAiCvB;;8DAE8D,GAC9D,OAAO,YAAI,qBACT,GAAG,OACH,WAAW,mBACX,QAAQ,oBACP,YAAY,KAAK,SAAS,YAAY,UAgNxC"}
|
package/_dist/graph.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sources":["../graph.ts"],"names":[],"mappings":"AAEA,SAAuC,KAAK,MAAM,2BAAgC;AAElF,OAAO,YAAI,uBAAsB,OAoD/B;AAEF,8EAA8E,GAC9E,OAAO,YAAI,eAAc,SAA+B"}
|
package/_dist/mod.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** A process as the machine holds it: `exit` is absent while it runs, and its
|
|
2
|
+
* code is null when the machine could not learn it. */ export type Proc = {
|
|
3
|
+
pid?: number;
|
|
4
|
+
exit?: {
|
|
5
|
+
code: number | null;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
/** Compatibility name for the shared Workspace interface. */ export type Machine = import("./workspace.js").Workspace;
|
|
9
|
+
export * from "./comp.js";
|
|
10
|
+
export { follow, settle, shellStat } from "./workspace.js";
|
|
11
|
+
export type { ComputerConnector, ComputerTransport, SettleOpts, Stat, Workspace, WorkspaceTarget } from "./workspace.js";
|
|
12
|
+
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sources":["../mod.ts"],"names":[],"mappings":"AAEA;qDACqD,GACrD,YAAY;EAAS,MAAM,MAAM;EAAE;IAAS,MAAM,MAAM,GAAG,IAAI;;;AAE/D,2DAA2D,GAC3D,YAAY,mCAAmC;AAE/C,0BAAyB;AAEzB,SAAS,MAAM,EAAE,MAAM,EAAE,SAAS,yBAAwB;AAC1D,cACE,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,IAAI,EACJ,SAAS,EACT,eAAe,yBACM"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Eid, Graph } from "@yaks/graph";
|
|
2
|
+
import type { Workspace } from "./workspace.js";
|
|
3
|
+
/** Give a workspace graph identities for its running commands and exits. */ export declare let recordedWorkspace: (g: Graph, workspace: Eid, port: Workspace) => Workspace;
|
|
4
|
+
//# sourceMappingURL=recorded.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recorded.d.ts","sources":["../recorded.ts"],"names":[],"mappings":"AAEA,cAAoB,GAAG,EAAE,KAAK,2BAAgC;AAE9D,cAAc,SAAS,yBAAwB;AAE/C,0EAA0E,GAC1E,OAAO,YAAI,oBACT,GAAG,OACH,WAAW,KACX,MAAM,cACL,UA8DF"}
|
package/_dist/room.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ComputerTransport } from "./workspace.js";
|
|
2
|
+
/** What a machine has room for: the bytes it could give without swapping,
|
|
3
|
+
* and the share of the last ten seconds some task waited
|
|
4
|
+
* for memory (PSI `some avg10`, a percentage). On Linux it also carries the
|
|
5
|
+
* share of the last minute some task waited for CPU or disk I/O. */ export type Room = {
|
|
6
|
+
available: number;
|
|
7
|
+
pressure: number;
|
|
8
|
+
cpuPressure?: number;
|
|
9
|
+
ioPressure?: number;
|
|
10
|
+
};
|
|
11
|
+
/** What one more run needs of a machine, and how long a run admitted holds a
|
|
12
|
+
* reservation before the machine's own reading counts it. */ export type Need = {
|
|
13
|
+
/** bytes a run takes at its peak */ memory: number;
|
|
14
|
+
/** the memory pressure (PSI `some avg10`) at or past which nothing starts */ pressure: number;
|
|
15
|
+
/** the sustained CPU pressure (PSI `some avg60`) that defers starts */ cpuPressure?: number;
|
|
16
|
+
/** the sustained disk I/O pressure (PSI `some avg60`) that defers starts */ ioPressure?: number;
|
|
17
|
+
/** ms a run admitted is reserved for: it starts small and grows */ settle: number;
|
|
18
|
+
};
|
|
19
|
+
/** An agent run on the box holds 0.3 to 0.6 GB, and its test runs add to that
|
|
20
|
+
* for a while (T-1463 measured 3.6 GB at p90 when tests were heavier). Each
|
|
21
|
+
* start reserves this much until the readings carry its growth. */ export declare let NEED: Need;
|
|
22
|
+
/** Read the machine's pressure, then its memory, in one control call. The
|
|
23
|
+
* cgroup mount root covers the container. Host I/O pressure also covers work
|
|
24
|
+
* outside it, such as Proxmox snapshots on the same disk. */ export declare let SCRIPT: string;
|
|
25
|
+
/** Read a machine's room from what {@link SCRIPT} prints. */ export declare let roomOf: (text: string) => Room;
|
|
26
|
+
/** Read a computer's room, optionally within a systemd user slice. */ export declare let room: (transport: ComputerTransport, slice?: string) => Promise<Room>;
|
|
27
|
+
/** Whether one more run fits, with `held` runs admitted but not yet grown. */ export declare let fits: (r: Room, need?: Need, held?: number) => boolean;
|
|
28
|
+
/** Read the room left for a start, reserving its need for `settle` ms if it
|
|
29
|
+
* fits. Calls are answered in order so a burst sees its own reservations. */ export declare let reserving: (read: () => Promise<Room>, need?: Need, now?: () => number) => () => Promise<Room>;
|
|
30
|
+
/**
|
|
31
|
+
* Whether a run can start now, with room reserved for recent starts.
|
|
32
|
+
*
|
|
33
|
+
* ```ts
|
|
34
|
+
* import { admitter } from '@yaks/machine/room'
|
|
35
|
+
*
|
|
36
|
+
* let admit = admitter(() =>
|
|
37
|
+
* Promise.resolve({ available: 9 * 1024 ** 3, pressure: 0 })
|
|
38
|
+
* )
|
|
39
|
+
* console.assert(await admit() && await admit() && !await admit())
|
|
40
|
+
* ```
|
|
41
|
+
*/ export declare let admitter: (read: () => Promise<Room>, need?: Need, now?: () => number) => () => Promise<boolean>;
|
|
42
|
+
/** The room of the computer this process runs on. */ export declare let hereRoom: (slice?: string) => Promise<Room>;
|
|
43
|
+
/** The {@link admitter} of the computer this process runs on. */ export declare let here: (need?: Need) => () => Promise<boolean>;
|
|
44
|
+
/** The room in the systemd slice that holds managed runs. */ export declare let managedRoom: () => Promise<Room>;
|
|
45
|
+
//# sourceMappingURL=room.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"room.d.ts","sources":["../room.ts"],"names":[],"mappings":"AAKA,cAAc,iBAAiB,yBAAwB;AAKvD;;;kEAGkE,GAClE,YAAY;EACV,WAAW,MAAM;EACjB,UAAU,MAAM;EAChB,cAAc,MAAM;EACpB,aAAa,MAAM;;AAGrB;2DAC2D,GAC3D,YAAY;EACV,kCAAkC,GAClC,QAAQ,MAAM;EACd,2EAA2E,GAC3E,UAAU,MAAM;EAChB,qEAAqE,GACrE,cAAc,MAAM;EACpB,0EAA0E,GAC1E,aAAa,MAAM;EACnB,iEAAiE,GACjE,QAAQ,MAAM;;AAGhB;;iEAEiE,GACjE,OAAO,YAAI,MAAM,KAMhB;AAED;;2DAE2D,GAC3D,OAAO,YAAI,eA2Be;AAgD1B,2DAA2D,GAC3D,OAAO,YAAI,SAAU,MAAM,MAAM,KAAG,KA4BnC;AAED,oEAAoE,GACpE,OAAO,YAAI,OACT,WAAW,mBACX,QAAQ,MAAM,KACb,QAAQ,MACkE;AAE7E,4EAA4E,GAC5E,OAAO,YAAI,OAAQ,GAAG,MAAM,OAAM,MAAa,kBAAW,OAAO,CAIhB;AAEjD;2EAC2E,GAC3E,OAAO,YAAI,YACT,YAAY,QAAQ,OACpB,OAAM,MACN,YAAW,MAAM,WACV,QAAQ,MAmBhB;AAED;;;;;;;;;;;CAWC,GACD,OAAO,YAAI,WACT,YAAY,QAAQ,OACpB,OAAM,MACN,YAAW,MAAM,WACV,QAAQ,OAAO,EAGvB;AAED,mDAAmD,GACnD,OAAO,YAAI,WAAkB,QAAQ,MAAM,KAAG,QAAQ,MACG;AAEzD,+DAA+D,GAC/D,OAAO,YAAI,OAAQ,OAAM,eAAoB,QAAQ,OAAO,EAClC;AAE1B,2DAA2D,GAC3D,OAAO,YAAI,mBAAkB,QAAQ,MAAmC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type Bundle, type Graph, Refused } from "@yaks/graph";
|
|
2
|
+
import type { Workspace } from "./workspace.js";
|
|
3
|
+
export type Workspaces = {
|
|
4
|
+
connect: (workspace: string) => Promise<Workspace>;
|
|
5
|
+
};
|
|
6
|
+
export type Target = {
|
|
7
|
+
workspace: string;
|
|
8
|
+
cwd: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* How a call names a workspace, and some it could name: the second half of
|
|
12
|
+
* every refusal for a call that named none, or named something else. The
|
|
13
|
+
* newest workspaces, one per directory, since many share one.
|
|
14
|
+
*/ export declare let naming: (g: Graph) => Promise<string>;
|
|
15
|
+
/** The refusal for a call left to a default sandbox the host does not lend. */ export declare let unlent: (g: Graph) => Promise<Refused>;
|
|
16
|
+
/** Resolve an explicit target or the session default, never a local fallback. */ export declare let targetFor: (g: Graph, session: string | undefined, args: Record<string, unknown>) => Promise<Target>;
|
|
17
|
+
/** A guarded default change. Omitting cwd explicitly clears the previous one. */ export declare let sessionHome: (g: Graph, session: string, workspace: string, cwd?: string) => Promise<Bundle[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Look once more at every workspace process with no `exit`. A look records the
|
|
20
|
+
* ending its receipt holds, so a run whose waiter stopped looking (a shell
|
|
21
|
+
* call's timeout, an aborted turn, the process that waited ending) gets its
|
|
22
|
+
* `exit` here. A workspace that refuses to connect (released, its placement
|
|
23
|
+
* unknown) has nothing to look at; any other failure goes to `failed`, and
|
|
24
|
+
* the other workspaces are still looked at. Answers how many were looked at.
|
|
25
|
+
*/ export declare let overdue: (g: Graph, workspaces: Workspaces, failed?: (error: unknown, workspace: string) => void) => Promise<number>;
|
|
26
|
+
/** Process operations ignore the caller's current home. */ export declare let processWorkspace: (g: Graph, process: string) => Promise<string>;
|
|
27
|
+
//# sourceMappingURL=targets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"targets.d.ts","sources":["../targets.ts"],"names":[],"mappings":"AAGA,SAAS,KAAK,MAAM,EAAa,KAAK,KAAK,EAAE,OAAO,2BAAgC;AAEpF,cAAc,SAAS,yBAAwB;AAE/C,YAAY;EACV,UAAU,WAAW,MAAM,KAAK,QAAQ;;AAE1C,YAAY;EAAW,WAAW,MAAM;EAAE,KAAK,MAAM;;AAGrD;;;;CAIC,GACD,OAAO,YAAI,SAAgB,GAAG,UAAQ,QAAQ,MAAM,EAanD;AAED,6EAA6E,GAC7E,OAAO,YAAI,SAAgB,GAAG,UAAQ,QAAQ,SAI3C;AAEH,+EAA+E,GAC/E,OAAO,YAAI,YACT,GAAG,OACH,SAAS,MAAM,GAAG,SAAS,EAC3B,MAAM,OAAO,MAAM,EAAE,OAAO,MAC3B,QAAQ,QAqBV;AAED,+EAA+E,GAC/E,OAAO,YAAI,cACT,GAAG,OACH,SAAS,MAAM,EACf,WAAW,MAAM,EACjB,MAAM,MAAM,KACX,QAAQ,UAeV;AAED;;;;;;;CAOC,GACD,OAAO,YAAI,UACT,GAAG,OACH,YAAY,YACZ,UAAS,OAAO,OAAO,EAAE,WAAW,MAAM,KAAK,IAAI,KAClD,QAAQ,MAAM,EAoBhB;AAED,yDAAyD,GACzD,OAAO,YAAI,mBACT,GAAG,OACH,SAAS,MAAM,KACd,QAAQ,MAAM,EAOhB"}
|