@source-repo/rpc-cli 4.5.0 → 5.0.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 +1 -0
- package/dist/console.d.ts +15 -2
- package/dist/console.d.ts.map +1 -1
- package/dist/console.js +49 -15
- package/dist/console.js.map +1 -1
- package/dist/console.types.json +483 -0
- package/dist/credentials.d.ts +77 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +118 -0
- package/dist/credentials.js.map +1 -0
- package/dist/enrolment.d.ts +91 -0
- package/dist/enrolment.d.ts.map +1 -0
- package/dist/enrolment.js +94 -0
- package/dist/enrolment.js.map +1 -0
- package/dist/extract.d.ts.map +1 -1
- package/dist/extract.js +97 -3
- package/dist/extract.js.map +1 -1
- package/dist/grants.d.ts +25 -0
- package/dist/grants.d.ts.map +1 -0
- package/dist/grants.js +62 -0
- package/dist/grants.js.map +1 -0
- package/dist/index.js +254 -41
- package/dist/index.js.map +1 -1
- package/dist/mcp.d.ts +5 -0
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +329 -2
- package/dist/mcp.js.map +1 -1
- package/dist/network.d.ts +47 -1
- package/dist/network.d.ts.map +1 -1
- package/dist/network.js +17 -1
- package/dist/network.js.map +1 -1
- package/dist/node.d.ts +15 -0
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +14 -1
- package/dist/node.js.map +1 -1
- package/dist/pairing.d.ts +52 -0
- package/dist/pairing.d.ts.map +1 -0
- package/dist/pairing.js +57 -0
- package/dist/pairing.js.map +1 -0
- package/dist/scripting.d.ts +10 -0
- package/dist/scripting.d.ts.map +1 -1
- package/dist/scripting.js +2 -2
- package/dist/scripting.js.map +1 -1
- package/dist/scripts.d.ts +27 -3
- package/dist/scripts.d.ts.map +1 -1
- package/dist/scripts.js +31 -8
- package/dist/scripts.js.map +1 -1
- package/dist/tasks.d.ts +189 -0
- package/dist/tasks.d.ts.map +1 -0
- package/dist/tasks.js +485 -0
- package/dist/tasks.js.map +1 -0
- package/dist/web/app.css +1 -1
- package/dist/web/app.js +12 -12
- package/dist/web/app.js.map +1 -1
- package/package.json +7 -5
package/dist/scripts.d.ts
CHANGED
|
@@ -26,7 +26,14 @@ export declare const nodeArgvFor: (file: string, version?: string) => string[];
|
|
|
26
26
|
*
|
|
27
27
|
* So a script does not hardcode a broker url that is right on one machine and wrong on the next -
|
|
28
28
|
* and so a model writing one has something to read rather than a value to invent. The names match
|
|
29
|
-
* the flags they came from
|
|
29
|
+
* the flags they came from.
|
|
30
|
+
*
|
|
31
|
+
* **This deliberately no longer hands over the node's own token.** It used to, and that was wrong
|
|
32
|
+
* twice: a token is pinned to exactly one peer name, so a script could not authenticate under its
|
|
33
|
+
* own name with it anyway, and passing it put the node's credential in the environment of an
|
|
34
|
+
* arbitrary program - which, for a program an AI wrote, is precisely the thing the boundary work
|
|
35
|
+
* exists to prevent. A script that must authenticate is given a credential of its own, minted for
|
|
36
|
+
* it and expiring on its own schedule; see `ScriptRunner`'s `credentialFor`.
|
|
30
37
|
*/
|
|
31
38
|
export declare const environmentFor: (options: NetworkOptions) => {
|
|
32
39
|
[key: string]: string;
|
|
@@ -47,13 +54,30 @@ export interface RunningScript {
|
|
|
47
54
|
export declare class ScriptRunner {
|
|
48
55
|
private directory;
|
|
49
56
|
private environment;
|
|
57
|
+
/**
|
|
58
|
+
* Mints the credential this script will connect with, when the node can. Called once per
|
|
59
|
+
* start, so each run gets its own short-lived credential rather than sharing one - and a
|
|
60
|
+
* node that cannot mint simply starts the script without one, which is honest: the script
|
|
61
|
+
* then reaches whatever an unauthenticated peer may reach, and nothing more.
|
|
62
|
+
*/
|
|
63
|
+
private credentialFor?;
|
|
50
64
|
private running;
|
|
51
65
|
private finished;
|
|
52
66
|
constructor(directory: string, environment?: {
|
|
53
67
|
[key: string]: string;
|
|
54
|
-
}
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* Mints the credential this script will connect with, when the node can. Called once per
|
|
71
|
+
* start, so each run gets its own short-lived credential rather than sharing one - and a
|
|
72
|
+
* node that cannot mint simply starts the script without one, which is honest: the script
|
|
73
|
+
* then reaches whatever an unauthenticated peer may reach, and nothing more.
|
|
74
|
+
*/
|
|
75
|
+
credentialFor?: ((script: string) => Promise<{
|
|
76
|
+
name: string;
|
|
77
|
+
token: string;
|
|
78
|
+
} | undefined>) | undefined);
|
|
55
79
|
isRunning(name: string): boolean;
|
|
56
|
-
start(name: string): RunningScript
|
|
80
|
+
start(name: string): Promise<RunningScript>;
|
|
57
81
|
stop(name: string): Promise<RunningScript>;
|
|
58
82
|
status(name: string): RunningScript | undefined;
|
|
59
83
|
all(): RunningScript[];
|
package/dist/scripts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scripts.d.ts","sourceRoot":"","sources":["../src/scripts.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AA8BlD,gGAAgG;AAChG,eAAO,MAAM,iBAAiB,YAAI,KAAK,EAAE,MAAM,CAAU,CAAA;AACzD,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,KAAK,CAAA;AASzC,6FAA6F;AAC7F,eAAO,MAAM,UAAU,cAAe,MAAM,QAAQ,MAAM,aAAY,cAAc,WAMnF,CAAA;AAED,uFAAuF;AACvF,eAAO,MAAM,UAAU,cAAe,MAAM,QAAQ,MAAM,WAOzD,CAAA;AAED,eAAO,MAAM,UAAU,cAAe,MAAM,QAAQ,MAAM,UAAU,MAAM,aAAY,cAAc,WAcnG,CAAA;AAED,eAAO,MAAM,UAAU,cAAe,MAAM,QAAQ,MAAM,WAAsD,CAAA;AAEhH,eAAO,MAAM,YAAY,cAAe,MAAM,QAAQ,MAAM,SAAwC,CAAA;AAEpG,eAAO,MAAM,WAAW,cAAe,MAAM;;cAIiE,cAAc;GAM3H,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,SAAU,MAAM,+B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E,CAAA;CACnB;AAED,sEAAsE;AACtE,qBAAa,YAAY;IAKjB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,WAAW;IACnB;;;;;OAKG;IACH,OAAO,CAAC,aAAa,CAAC;IAZ1B,OAAO,CAAC,OAAO,CAAoE;IACnF,OAAO,CAAC,QAAQ,CAAmC;IAEnD,YACY,SAAS,EAAE,MAAM,EACjB,WAAW,GAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAO;IACnD;;;;;OAKG;IACK,aAAa,CAAC,GAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC,aAAA,EAChG;IAEJ,SAAS,CAAC,IAAI,EAAE,MAAM,WAErB;IAEK,KAAK,CAAC,IAAI,EAAE,MAAM,0BA4CvB;IAEK,IAAI,CAAC,IAAI,EAAE,MAAM,0BAetB;IAED,MAAM,CAAC,IAAI,EAAE,MAAM,6BAElB;IAED,GAAG,IAAI,aAAa,EAAE,CAErB;IAEK,OAAO,kBAEZ;CACJ"}
|
package/dist/scripts.js
CHANGED
|
@@ -107,40 +107,63 @@ export const nodeArgvFor = (file, version = process.versions.node) => {
|
|
|
107
107
|
*
|
|
108
108
|
* So a script does not hardcode a broker url that is right on one machine and wrong on the next -
|
|
109
109
|
* and so a model writing one has something to read rather than a value to invent. The names match
|
|
110
|
-
* the flags they came from
|
|
110
|
+
* the flags they came from.
|
|
111
|
+
*
|
|
112
|
+
* **This deliberately no longer hands over the node's own token.** It used to, and that was wrong
|
|
113
|
+
* twice: a token is pinned to exactly one peer name, so a script could not authenticate under its
|
|
114
|
+
* own name with it anyway, and passing it put the node's credential in the environment of an
|
|
115
|
+
* arbitrary program - which, for a program an AI wrote, is precisely the thing the boundary work
|
|
116
|
+
* exists to prevent. A script that must authenticate is given a credential of its own, minted for
|
|
117
|
+
* it and expiring on its own schedule; see `ScriptRunner`'s `credentialFor`.
|
|
111
118
|
*/
|
|
112
119
|
export const environmentFor = (options) => ({
|
|
113
120
|
...(options.broker ? { SOURCE_RPC_BROKER: options.broker } : {}),
|
|
114
121
|
...(options.hub ? { SOURCE_RPC_HUB: options.hub } : {}),
|
|
115
|
-
...(options.prefix ? { SOURCE_RPC_PREFIX: options.prefix } : {})
|
|
116
|
-
...(options.hubCredentials?.token
|
|
117
|
-
? { SOURCE_RPC_TOKEN: options.hubCredentials.token }
|
|
118
|
-
: {})
|
|
122
|
+
...(options.prefix ? { SOURCE_RPC_PREFIX: options.prefix } : {})
|
|
119
123
|
});
|
|
120
124
|
/** Starts, stops and remembers the scripts this server is running. */
|
|
121
125
|
export class ScriptRunner {
|
|
122
126
|
directory;
|
|
123
127
|
environment;
|
|
128
|
+
credentialFor;
|
|
124
129
|
running = new Map();
|
|
125
130
|
finished = new Map();
|
|
126
|
-
constructor(directory, environment = {}
|
|
131
|
+
constructor(directory, environment = {},
|
|
132
|
+
/**
|
|
133
|
+
* Mints the credential this script will connect with, when the node can. Called once per
|
|
134
|
+
* start, so each run gets its own short-lived credential rather than sharing one - and a
|
|
135
|
+
* node that cannot mint simply starts the script without one, which is honest: the script
|
|
136
|
+
* then reaches whatever an unauthenticated peer may reach, and nothing more.
|
|
137
|
+
*/
|
|
138
|
+
credentialFor) {
|
|
127
139
|
this.directory = directory;
|
|
128
140
|
this.environment = environment;
|
|
141
|
+
this.credentialFor = credentialFor;
|
|
129
142
|
}
|
|
130
143
|
isRunning(name) {
|
|
131
144
|
return this.running.has(name);
|
|
132
145
|
}
|
|
133
|
-
start(name) {
|
|
146
|
+
async start(name) {
|
|
134
147
|
if (this.running.has(name))
|
|
135
148
|
throw new Error(`'${name}' is already running. Stop it first.`);
|
|
136
149
|
const file = scriptFile(this.directory, name);
|
|
137
150
|
const argv = nodeArgvFor(file);
|
|
151
|
+
// Minted per start, before the process exists, so the credential is never written anywhere
|
|
152
|
+
// the script could have read it from earlier.
|
|
153
|
+
const credential = await this.credentialFor?.(name);
|
|
138
154
|
const record = { name, startedAt: Date.now(), output: [] };
|
|
139
155
|
const child = spawn(process.execPath, argv, {
|
|
140
156
|
// The script's own directory, so a relative import in it means what its author meant and
|
|
141
157
|
// `@source-repo/rpc` resolves from the project the directory sits in.
|
|
142
158
|
cwd: resolve(this.directory),
|
|
143
|
-
env: {
|
|
159
|
+
env: {
|
|
160
|
+
...process.env,
|
|
161
|
+
...this.environment,
|
|
162
|
+
// The name is handed over with the credential, because a derived credential is
|
|
163
|
+
// pinned to one peer name: a script that picks its own would be refused by the bus
|
|
164
|
+
// rather than mysteriously ignored.
|
|
165
|
+
...(credential ? { SOURCE_RPC_NAME: credential.name, SOURCE_RPC_TOKEN: credential.token } : {})
|
|
166
|
+
},
|
|
144
167
|
stdio: ['ignore', 'pipe', 'pipe']
|
|
145
168
|
});
|
|
146
169
|
record.pid = child.pid ?? undefined;
|
package/dist/scripts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scripts.js","sourceRoot":"","sources":["../src/scripts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACjG,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,8FAA8F;AAC9F,MAAM,gBAAgB,GAAG,mCAAmC,CAAA;AAE5D,gGAAgG;AAChG,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,MAAM,CAAU,CAAA;AAGzD,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QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IACpE,CAAC;IAED,GAAG;QACC,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;IAClG,CAAC;IAED,KAAK,CAAC,OAAO;QACT,KAAK,MAAM,IAAI,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAAE,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;IAC7F,CAAC;CACJ"}
|
package/dist/tasks.d.ts
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { type SigningKeys } from './credentials.js';
|
|
2
|
+
/**
|
|
3
|
+
* What `run` starts when nothing is named, and what `run --init` writes when nothing is named.
|
|
4
|
+
*
|
|
5
|
+
* Looked for in the working directory and nowhere else. Walking up the tree the way `package.json`
|
|
6
|
+
* is found would mean that running this three directories deep silently starts the roles described
|
|
7
|
+
* somewhere above — with that file's signing secrets, under that file's peer names, on that file's
|
|
8
|
+
* bus. A task file is an identity, so which one ran must never depend on where the shell happened
|
|
9
|
+
* to be. Named for what it is rather than `tasks.json`, which is already several other things.
|
|
10
|
+
*/
|
|
11
|
+
export declare const defaultTaskFile = "source-rpc.tasks.json";
|
|
12
|
+
/** MQTT's own username and password, which authenticate the connection rather than the peer. */
|
|
13
|
+
export interface TaskMqttAuth {
|
|
14
|
+
username?: string;
|
|
15
|
+
password?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface TaskNetwork {
|
|
18
|
+
broker?: string;
|
|
19
|
+
hub?: string;
|
|
20
|
+
prefix?: string;
|
|
21
|
+
timeout?: number;
|
|
22
|
+
insecureTls?: boolean;
|
|
23
|
+
mqtt?: TaskMqttAuth;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* What a task presents when a bus asks who it is: a bearer token for a hub, and the `derive` secret
|
|
27
|
+
* a node mints its scripts' credentials with.
|
|
28
|
+
*
|
|
29
|
+
* `tokens` and `issuers` are deliberately not here. Those say what a *bus* accepts, and no task type
|
|
30
|
+
* is a bus - putting them in a host's file would be writing a policy nothing in that file enforces.
|
|
31
|
+
*/
|
|
32
|
+
export interface TaskAuth {
|
|
33
|
+
token?: string;
|
|
34
|
+
derive?: string;
|
|
35
|
+
}
|
|
36
|
+
interface CommonTask {
|
|
37
|
+
id: string;
|
|
38
|
+
type: 'console' | 'node' | 'serve';
|
|
39
|
+
network?: TaskNetwork;
|
|
40
|
+
name?: string;
|
|
41
|
+
/** A path to a key file, or the same keys written inline. */
|
|
42
|
+
sign?: string | SigningKeys;
|
|
43
|
+
/** A path to an auth file, or the same credentials written inline. */
|
|
44
|
+
auth?: string | TaskAuth;
|
|
45
|
+
}
|
|
46
|
+
export interface ConsoleTask extends CommonTask {
|
|
47
|
+
type: 'console';
|
|
48
|
+
host?: string;
|
|
49
|
+
port?: number;
|
|
50
|
+
basePath?: string;
|
|
51
|
+
/** Serve HTTPS, and WSS with it. Both together, and they move the default port to 8844. */
|
|
52
|
+
cert?: string;
|
|
53
|
+
key?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface NodeTask extends CommonTask {
|
|
56
|
+
type: 'node';
|
|
57
|
+
scripts: string;
|
|
58
|
+
scriptableBy: string[];
|
|
59
|
+
/**
|
|
60
|
+
* Path to the AI grants document. A path only, never inline: the document carries its own
|
|
61
|
+
* revision so that policy can be replaced on its own cadence, and burying it in a file that
|
|
62
|
+
* changes for unrelated reasons takes that away. It is policy rather than a secret, so the
|
|
63
|
+
* argument that put `sign` and `auth` inline does not apply to it.
|
|
64
|
+
*/
|
|
65
|
+
grants?: string;
|
|
66
|
+
}
|
|
67
|
+
export interface ServeTask extends CommonTask {
|
|
68
|
+
type: 'serve';
|
|
69
|
+
contract: string;
|
|
70
|
+
script?: string;
|
|
71
|
+
allowExec?: boolean;
|
|
72
|
+
}
|
|
73
|
+
export type SourceRpcTask = ConsoleTask | NodeTask | ServeTask;
|
|
74
|
+
export interface SourceRpcTaskFile {
|
|
75
|
+
version: 1;
|
|
76
|
+
network?: TaskNetwork;
|
|
77
|
+
tasks: SourceRpcTask[];
|
|
78
|
+
}
|
|
79
|
+
export interface StartedTask {
|
|
80
|
+
id: string;
|
|
81
|
+
type: SourceRpcTask['type'];
|
|
82
|
+
name: string;
|
|
83
|
+
url?: string;
|
|
84
|
+
namespaces?: string[];
|
|
85
|
+
}
|
|
86
|
+
export interface TaskFileRun {
|
|
87
|
+
file: string;
|
|
88
|
+
tasks: StartedTask[];
|
|
89
|
+
close: () => Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Re-read every node task's grants document and apply it, reporting through `warning`.
|
|
92
|
+
*
|
|
93
|
+
* Here as well as on `node` because `run` is how a host is meant to be started, and a grant that
|
|
94
|
+
* can only be closed by restarting the process is one that cannot be closed while something is
|
|
95
|
+
* going wrong. A document that fails to re-read leaves the one in force alone.
|
|
96
|
+
*/
|
|
97
|
+
reloadGrants: () => void;
|
|
98
|
+
}
|
|
99
|
+
export interface TaskFileCallbacks {
|
|
100
|
+
started?: (task: StartedTask) => void;
|
|
101
|
+
warning?: (message: string) => void;
|
|
102
|
+
}
|
|
103
|
+
/** Parse strictly so a misspelled setting is a startup error rather than an ignored intention. */
|
|
104
|
+
export declare const parseTaskFile: (value: unknown) => SourceRpcTaskFile;
|
|
105
|
+
/**
|
|
106
|
+
* A certificate moves the default port the same way `--cert` does, so the convention holds without
|
|
107
|
+
* anyone having to remember it. An explicit port always wins, since a plant with its own numbering
|
|
108
|
+
* has the last word.
|
|
109
|
+
*/
|
|
110
|
+
export declare const consolePortFor: (task: ConsoleTask, secure: boolean) => number;
|
|
111
|
+
/** Start every task in one process, rolling back the earlier ones if a later task cannot start. */
|
|
112
|
+
export declare const startTaskFile: (path: string, callbacks?: TaskFileCallbacks) => Promise<TaskFileRun>;
|
|
113
|
+
/**
|
|
114
|
+
* A task file with the three roles in it, ready to edit.
|
|
115
|
+
*
|
|
116
|
+
* The secrets are real rather than placeholders, and that is the point of generating one at all: the
|
|
117
|
+
* shape of a task file is easy to type out from the documentation, and a secret somebody invents at
|
|
118
|
+
* a keyboard is the part that is reliably done badly. Every role gets its own, and each one's
|
|
119
|
+
* `peers` names the others, so the file that lands is a network whose members already know each
|
|
120
|
+
* other rather than a template with `<secret>` in five places.
|
|
121
|
+
*
|
|
122
|
+
* `controller` is in every `peers` map without being a task here, because the reason to run a
|
|
123
|
+
* scriptable node is that something elsewhere scripts it. Its secret is in this file for whoever
|
|
124
|
+
* sets that machine up to copy out - printing it would put it in a scrollback and a terminal log.
|
|
125
|
+
*/
|
|
126
|
+
export declare const taskFileSkeleton: (options?: {
|
|
127
|
+
broker?: string;
|
|
128
|
+
hub?: string;
|
|
129
|
+
controller?: string;
|
|
130
|
+
}) => {
|
|
131
|
+
version: 1;
|
|
132
|
+
network: {
|
|
133
|
+
hub: string;
|
|
134
|
+
timeout: number;
|
|
135
|
+
} | {
|
|
136
|
+
broker: string;
|
|
137
|
+
timeout: number;
|
|
138
|
+
};
|
|
139
|
+
tasks: ({
|
|
140
|
+
id: string;
|
|
141
|
+
type: 'console';
|
|
142
|
+
sign: {
|
|
143
|
+
name: string;
|
|
144
|
+
secret: string;
|
|
145
|
+
peers: {
|
|
146
|
+
[k: string]: string;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
host: string;
|
|
150
|
+
port: number;
|
|
151
|
+
scripts?: undefined;
|
|
152
|
+
scriptableBy?: undefined;
|
|
153
|
+
contract?: undefined;
|
|
154
|
+
} | {
|
|
155
|
+
host?: undefined;
|
|
156
|
+
port?: undefined;
|
|
157
|
+
id: string;
|
|
158
|
+
type: 'node';
|
|
159
|
+
sign: {
|
|
160
|
+
name: string;
|
|
161
|
+
secret: string;
|
|
162
|
+
peers: {
|
|
163
|
+
[k: string]: string;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
scripts: string;
|
|
167
|
+
scriptableBy: string[];
|
|
168
|
+
contract?: undefined;
|
|
169
|
+
} | {
|
|
170
|
+
host?: undefined;
|
|
171
|
+
port?: undefined;
|
|
172
|
+
scripts?: undefined;
|
|
173
|
+
scriptableBy?: undefined;
|
|
174
|
+
id: string;
|
|
175
|
+
type: 'serve';
|
|
176
|
+
sign: {
|
|
177
|
+
name: string;
|
|
178
|
+
secret: string;
|
|
179
|
+
peers: {
|
|
180
|
+
[k: string]: string;
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
contract: string;
|
|
184
|
+
})[];
|
|
185
|
+
};
|
|
186
|
+
/** What the generated file still needs from whoever generated it, in the order they have to do it. */
|
|
187
|
+
export declare const taskFileSkeletonNotes: (file: string, controller?: string) => string[];
|
|
188
|
+
export {};
|
|
189
|
+
//# sourceMappingURL=tasks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../src/tasks.ts"],"names":[],"mappings":"AAMA,OAAO,EAA0G,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAM3J;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,0BAA0B,CAAA;AAEtD,gGAAgG;AAChG,MAAM,WAAW,YAAY;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,WAAW;IACxB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,IAAI,CAAC,EAAE,YAAY,CAAA;CACtB;AAED;;;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