copilotz 1.0.0-rc.21 → 1.0.0-rc.23
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/CHANGELOG.md +320 -1
- package/README.md +217 -87
- package/hosts/orgs/mod.d.ts +33 -13
- package/hosts/orgs/mod.js +183 -84
- package/hosts/web/address.d.ts +11 -0
- package/hosts/web/address.js +46 -0
- package/hosts/web/assets.js +11 -5
- package/hosts/web/entrances.d.ts +250 -0
- package/hosts/web/entrances.js +362 -0
- package/hosts/web/host.d.ts +15 -3
- package/hosts/web/host.js +31 -18
- package/hosts/web/mod.d.ts +4 -2
- package/hosts/web/mod.js +6 -0
- package/hosts/web/node/bundle.d.ts +5 -0
- package/hosts/web/node/bundle.js +1 -1
- package/hosts/web/node/mod.d.ts +6 -4
- package/hosts/web/node/mod.js +6 -4
- package/hosts/web/node/serve.d.ts +20 -23
- package/hosts/web/node/serve.js +10 -21
- package/hosts/web/routes.d.ts +23 -17
- package/hosts/web/routes.js +56 -32
- package/hosts/web/server.d.ts +89 -44
- package/hosts/web/server.js +208 -108
- package/hosts/web/signin.d.ts +7 -10
- package/hosts/web/signin.js +6 -3
- package/hosts/web/surface.d.ts +20 -0
- package/hosts/web/surface.js +42 -0
- package/hosts/web/theme/css.d.ts +2 -1
- package/hosts/web/theme/css.js +9 -2
- package/hosts/web/tickets.d.ts +14 -1
- package/hosts/web/tickets.js +30 -7
- package/hosts/web/widget.d.ts +31 -0
- package/hosts/web/widget.js +429 -0
- package/hosts/web/widgets.d.ts +43 -0
- package/hosts/web/widgets.js +117 -0
- package/package.json +5 -1
- package/plugins/access/contacts/actions/forget.js +3 -1
- package/plugins/access/contacts/actions/start.js +18 -8
- package/plugins/access/contacts/collections/contact.d.ts +2 -2
- package/plugins/access/contacts/collections/contact.js +1 -1
- package/plugins/access/contacts/contract.d.ts +5 -5
- package/plugins/access/contacts/contract.js +5 -5
- package/plugins/access/contacts/mod.d.ts +4 -0
- package/plugins/access/contacts/mod.js +4 -0
- package/plugins/access/contacts/views/contact.js +1 -0
- package/plugins/access/dev/actions/sign-in.d.ts +1 -0
- package/plugins/access/dev/actions/sign-in.js +38 -0
- package/plugins/access/dev/mod.d.ts +17 -0
- package/plugins/access/dev/mod.js +31 -0
- package/plugins/access/dev/shared/nearby.d.ts +2 -0
- package/plugins/access/dev/shared/nearby.js +27 -0
- package/plugins/access/directory/actions/invite.js +2 -2
- package/plugins/access/directory/actions/org.js +11 -8
- package/plugins/access/directory/collections/credit-code.d.ts +1 -1
- package/plugins/access/google/actions/sign-in.js +2 -0
- package/plugins/access/google/mod.d.ts +4 -2
- package/plugins/access/google/mod.js +15 -2
- package/plugins/access/identity/actions/session.js +5 -3
- package/plugins/access/identity/mod.d.ts +4 -2
- package/plugins/access/identity/mod.js +17 -2
- package/plugins/access/mod.d.ts +7 -0
- package/plugins/access/mod.js +1 -0
- package/plugins/access/spaces/shared/declared.d.ts +1 -1
- package/plugins/access/spaces/shared/rules.d.ts +16 -5
- package/plugins/access/spaces/shared/rules.js +74 -6
- package/plugins/agents/chat/actions/send.d.ts +21 -0
- package/plugins/agents/chat/actions/send.js +72 -13
- package/plugins/agents/chat/collections/file.d.ts +15 -0
- package/plugins/agents/chat/collections/file.js +12 -3
- package/plugins/agents/chat/collections/live.d.ts +11 -0
- package/plugins/agents/chat/collections/live.js +11 -1
- package/plugins/agents/chat/collections/message.d.ts +1 -1
- package/plugins/agents/chat/collections/wait.d.ts +1 -1
- package/plugins/agents/chat/contract.d.ts +3 -2
- package/plugins/agents/chat/contract.js +1 -0
- package/plugins/agents/chat/mod.d.ts +9 -3
- package/plugins/agents/chat/mod.js +28 -7
- package/plugins/agents/chat/processors/failed.js +8 -3
- package/plugins/agents/chat/processors/turn.js +6 -3
- package/plugins/agents/chat/shared/agents.js +11 -2
- package/plugins/agents/chat/shared/live.d.ts +4 -2
- package/plugins/agents/chat/shared/live.js +2 -1
- package/plugins/agents/chat/shared/types.d.ts +8 -0
- package/plugins/agents/history/collections/outline.d.ts +2 -2
- package/plugins/agents/openapi/shared/files.js +2 -0
- package/plugins/agents/routines/collections/routine.d.ts +1 -1
- package/plugins/billing/credits/collections/plan.d.ts +2 -2
- package/plugins/billing/credits/collections/room.d.ts +1 -1
- package/plugins/billing/usage/collections/rollup.d.ts +2 -2
- package/plugins/billing/usage/collections/usage.d.ts +2 -2
- package/plugins/compute/cloud/actions/pool.js +2 -0
- package/plugins/compute/cloud/actions/remote.js +4 -2
- package/plugins/compute/cloud/actions/vms.js +2 -0
- package/plugins/compute/cloud/collections/pool-vm.d.ts +1 -1
- package/plugins/compute/computers/actions/admit.js +2 -0
- package/plugins/compute/computers/actions/code.js +2 -0
- package/plugins/compute/computers/actions/enrollment.js +2 -0
- package/plugins/compute/computers/actions/work.js +3 -0
- package/plugins/compute/computers/program/version.d.ts +1 -1
- package/plugins/compute/computers/program/version.js +1 -1
- package/plugins/compute/computers/resources/downloads.js +1 -1
- package/plugins/compute/computers/resources/previews.js +5 -2
- package/plugins/interfaces/maintenance/mod.d.ts +3 -1
- package/plugins/interfaces/maintenance/mod.js +3 -1
- package/plugins/interfaces/mcp/actions/call.d.ts +4 -0
- package/plugins/interfaces/mcp/actions/call.js +120 -18
- package/plugins/interfaces/mcp/actions/conversation.d.ts +1 -0
- package/plugins/interfaces/mcp/actions/conversation.js +49 -0
- package/plugins/interfaces/mcp/actions/prune.js +5 -3
- package/plugins/interfaces/mcp/collections/opening.d.ts +24 -0
- package/plugins/interfaces/mcp/collections/opening.js +28 -0
- package/plugins/interfaces/mcp/mod.d.ts +27 -3
- package/plugins/interfaces/mcp/mod.js +42 -7
- package/plugins/interfaces/mcp/resources/server.d.ts +13 -4
- package/plugins/interfaces/mcp/resources/server.js +163 -21
- package/plugins/interfaces/mcp/resources/tools.d.ts +88 -12
- package/plugins/interfaces/mcp/resources/tools.js +113 -19
- package/plugins/interfaces/mcp/resources/widgets.d.ts +161 -0
- package/plugins/interfaces/mcp/resources/widgets.js +246 -0
- package/plugins/interfaces/mcp/shared/keys.d.ts +25 -19
- package/plugins/interfaces/mcp/shared/keys.js +55 -9
- package/plugins/interfaces/mcp/shared/settings.d.ts +70 -37
- package/plugins/interfaces/mcp/shared/settings.js +64 -39
- package/plugins/interfaces/mcp/views/offered.d.ts +1 -1
- package/plugins/interfaces/mod.d.ts +2 -1
- package/plugins/interfaces/mod.js +2 -1
- package/plugins/interfaces/voice/collections/blocked.d.ts +2 -2
- package/plugins/interfaces/voice/collections/call.d.ts +3 -3
- package/plugins/interfaces/voice/contract.d.ts +1 -1
- package/plugins/interfaces/voice/mod.d.ts +3 -3
- package/plugins/interfaces/voice/mod.js +3 -3
- package/plugins/interfaces/voice/resources/relay.d.ts +5 -3
- package/plugins/interfaces/voice/resources/relay.js +17 -6
- package/plugins/interfaces/voice/resources/tools.js +2 -0
- package/plugins/interfaces/voice/shared/settings.d.ts +5 -0
- package/plugins/interfaces/voice/views/call.d.ts +18 -11
- package/plugins/interfaces/voice/views/call.js +15 -3
- package/plugins/interfaces/voice/views/message.d.ts +1 -1
- package/plugins/interfaces/web/actions/arrive.d.ts +1 -0
- package/plugins/interfaces/web/actions/arrive.js +120 -0
- package/plugins/interfaces/web/actions/prune.d.ts +1 -0
- package/plugins/interfaces/web/actions/prune.js +51 -0
- package/plugins/interfaces/web/actions/sending.d.ts +1 -0
- package/plugins/interfaces/web/actions/sending.js +222 -0
- package/plugins/interfaces/web/actions/spent.d.ts +2 -0
- package/plugins/interfaces/web/actions/spent.js +59 -0
- package/plugins/interfaces/web/collections/rate.d.ts +122 -0
- package/plugins/interfaces/web/collections/rate.js +37 -0
- package/plugins/interfaces/web/collections/visitor.d.ts +110 -0
- package/plugins/interfaces/web/collections/visitor.js +64 -0
- package/plugins/interfaces/web/contract.d.ts +4 -0
- package/plugins/interfaces/web/contract.js +1 -0
- package/plugins/interfaces/web/lines.d.ts +36 -0
- package/plugins/interfaces/web/lines.js +78 -0
- package/plugins/interfaces/web/processors/forget.d.ts +10 -0
- package/plugins/interfaces/web/processors/forget.js +14 -0
- package/plugins/interfaces/web/resources/entrance.d.ts +47 -0
- package/plugins/interfaces/web/resources/entrance.js +83 -0
- package/plugins/interfaces/web/resources/spend.d.ts +2 -0
- package/plugins/interfaces/web/resources/spend.js +62 -0
- package/plugins/interfaces/web/shared/budget.d.ts +65 -0
- package/plugins/interfaces/web/shared/budget.js +134 -0
- package/plugins/interfaces/web/shared/lines.d.ts +158 -0
- package/plugins/interfaces/web/shared/lines.js +156 -0
- package/plugins/interfaces/web/shared/secret.d.ts +33 -0
- package/plugins/interfaces/web/shared/secret.js +86 -0
- package/plugins/interfaces/whatsapp/collections/phone.d.ts +1 -1
- package/plugins/interfaces/whatsapp/mod.d.ts +1 -1
- package/plugins/interfaces/whatsapp/mod.js +1 -1
- package/plugins/interfaces/whatsapp/views/message.d.ts +1 -1
- package/plugins/models/contract.d.ts +1 -1
- package/plugins/models/shared/generate.js +13 -4
- package/plugins/models/shared/transcribe.js +7 -1
- package/plugins/models/shared/use.d.ts +16 -2
- package/plugins/models/shared/use.js +20 -0
- package/runtime/browsers.d.ts +153 -17
- package/runtime/browsers.js +336 -30
- package/runtime/cache.js +25 -5
- package/runtime/caller.d.ts +117 -0
- package/runtime/caller.js +215 -0
- package/runtime/client.d.ts +47 -3
- package/runtime/client.js +132 -42
- package/runtime/define.d.ts +30 -9
- package/runtime/executor.js +7 -6
- package/runtime/expiring.d.ts +23 -0
- package/runtime/expiring.js +64 -0
- package/runtime/links.d.ts +27 -4
- package/runtime/links.js +49 -11
- package/runtime/memory.js +102 -15
- package/runtime/mod.d.ts +3 -1
- package/runtime/mod.js +3 -1
- package/runtime/mongo.d.ts +12 -0
- package/runtime/mongo.js +44 -0
- package/runtime/observe.js +82 -9
- package/runtime/ops.d.ts +9 -1
- package/runtime/owner.d.ts +14 -1
- package/runtime/owner.js +78 -23
- package/runtime/reads.js +2 -2
- package/runtime/registry.js +9 -3
- package/runtime/runtime.d.ts +7 -0
- package/runtime/runtime.js +1 -0
- package/runtime/timers.js +2 -0
- package/runtime/views.d.ts +1 -1
- package/runtime/views.js +2 -2
- package/runtime/wire.d.ts +1 -1
- package/stores/sql/postgres/maintenance.d.ts +8 -1
- package/stores/sql/postgres/maintenance.js +76 -9
- package/stores/sql/postgres/mod.d.ts +12 -4
- package/stores/sql/postgres/mod.js +21 -8
- package/plugins/interfaces/mcp/shared/caller.d.ts +0 -45
- package/plugins/interfaces/mcp/shared/caller.js +0 -99
|
@@ -26,9 +26,12 @@
|
|
|
26
26
|
* everything in it; not while an agent is writing in it.
|
|
27
27
|
* - A chat can be opened empty (`chat.open`), to share it with a contact
|
|
28
28
|
* (someone outside the org, who then writes there with `chat.send` and
|
|
29
|
-
* reaches only it
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* reaches only it, never its agents' private steps); a contact's message
|
|
30
|
+
* is let in first by the app's `contactSend` hooks (a web visitor's
|
|
31
|
+
* limits, and its own chat, opened with its first message); trusted code
|
|
32
|
+
* has an agent say a fixed message in one without a turn (`chat.say`: a
|
|
33
|
+
* payment confirmed), and erases one with everything in it (`chat.erase`:
|
|
34
|
+
* someone's data, gone).
|
|
32
35
|
* - After an agent's answer, a medium may show more (additions: a carousel
|
|
33
36
|
* of trips after the answer that found them), each once per chat per key,
|
|
34
37
|
* recorded in `shown` (`chat.shown`), and told to the model after that
|
|
@@ -58,6 +61,9 @@
|
|
|
58
61
|
* - `agentSources`: { action }: `{ names }` in, the definitions of those the asker meets out;
|
|
59
62
|
* - `roster`: { action }: `{ space }` in, `{ agents, default? }` out;
|
|
60
63
|
* - `agentModel`: { action }: `{ agent, space? }` in, a model or null out;
|
|
64
|
+
* - `contactSend`: { action }: asked as a contact about to send, `{ thread?,
|
|
65
|
+
* files }` in (each file's name, type and size); it refuses, or answers
|
|
66
|
+
* `{ thread?, transcribe?: false }` (see actions/send.ts);
|
|
61
67
|
* - `additions`: { order?, agents? }, each with an `addition:<name>` View in
|
|
62
68
|
* the medium that shows it, given `{ thread, answer }` (see `Addition`).
|
|
63
69
|
*/
|
|
@@ -134,12 +140,27 @@ export const chat = definePlugin({
|
|
|
134
140
|
// Conversations by title on Usage.
|
|
135
141
|
usageNames: { thread: { tag: "tags.thread", collection: "thread", field: "title" } },
|
|
136
142
|
// With the access plugin, chats live in spaces, and what's in a chat comes with it when it's
|
|
137
|
-
// shared on its own (with a contact): its messages, files and what's being written.
|
|
143
|
+
// shared on its own (with a contact): its messages, files and what's being written. A contact
|
|
144
|
+
// reads what's said there, never its agents' private steps (their tools' calls, with what each
|
|
145
|
+
// returned), a tool's files, nor what's being written that may become one: of a turn that
|
|
146
|
+
// offers tools, only that the agent is at work (no words, no call, no broken call's reason, a
|
|
147
|
+
// provider's own); of one that offers none (`open`: every step an answer), its words as they come.
|
|
138
148
|
shared: {
|
|
139
149
|
thread: {},
|
|
140
|
-
message: {
|
|
141
|
-
|
|
142
|
-
|
|
150
|
+
message: {
|
|
151
|
+
labels: true,
|
|
152
|
+
part: "thread",
|
|
153
|
+
contact: { private: { $ne: true }, toolCalls: { $exists: false } },
|
|
154
|
+
},
|
|
155
|
+
file: { part: "thread", contact: { private: { $ne: true } } },
|
|
156
|
+
live: {
|
|
157
|
+
part: "thread",
|
|
158
|
+
contact: {
|
|
159
|
+
"calls.0": { $exists: false },
|
|
160
|
+
retry: { $exists: false },
|
|
161
|
+
$or: [{ open: true }, { text: "" }],
|
|
162
|
+
},
|
|
163
|
+
},
|
|
143
164
|
shown: { part: "thread" },
|
|
144
165
|
},
|
|
145
166
|
},
|
|
@@ -7,7 +7,8 @@ export const failedProcessor = {
|
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
9
|
* Writes an answer for a turn that failed for good, so whoever waits on it
|
|
10
|
-
* resumes. A stopped turn (`chat.stop`) answers with what it had written
|
|
10
|
+
* resumes. A stopped turn (`chat.stop`) answers with what it had written,
|
|
11
|
+
* when that was surely an answer (its turn offered no tools).
|
|
11
12
|
*/
|
|
12
13
|
const failed = async (ctx, event) => {
|
|
13
14
|
const { event: run, type, data, error } = event.data;
|
|
@@ -20,8 +21,12 @@ const failed = async (ctx, event) => {
|
|
|
20
21
|
ctx.db.collection("live").findOne({ _id: run }),
|
|
21
22
|
ctx.db.collection("intent").findOne({ _id: run }),
|
|
22
23
|
]);
|
|
23
|
-
// Text of a step it was taking stays that step's (the answer keeps it)
|
|
24
|
-
|
|
24
|
+
// Text of a step it was taking stays that step's (the answer keeps it); so do words not yet
|
|
25
|
+
// known to be an answer (its turn offers tools: they may have been a step's), which everyone in
|
|
26
|
+
// the chat, a contact too, would read.
|
|
27
|
+
const text = written?.text && written.open && !taking
|
|
28
|
+
? `${written.text} (stopped)`
|
|
29
|
+
: "(stopped)";
|
|
25
30
|
return await answer(ctx, t, run, text, { stopped: true });
|
|
26
31
|
}
|
|
27
32
|
// The org's limit isn't the agent failing: it says what happened, and who can change it.
|
|
@@ -6,7 +6,7 @@ import { liveWriter } from "../shared/live.js";
|
|
|
6
6
|
import { prepare } from "../shared/send.js";
|
|
7
7
|
import { noted, startedWith } from "../shared/summary.js";
|
|
8
8
|
import { runTool, toolText } from "../shared/tools.js";
|
|
9
|
-
import { settingsOf } from "../shared/types.js";
|
|
9
|
+
import { settingsOf, } from "../shared/types.js";
|
|
10
10
|
/** Runs a turn: started by `turn.requested`, or resumed when its wait is over. */
|
|
11
11
|
/**
|
|
12
12
|
* A turn someone started (a person, or a contact in its chat) acts as its
|
|
@@ -112,8 +112,11 @@ const turn = async (ctx, event) => {
|
|
|
112
112
|
const named = await agentsNamed(ctx, seen.flatMap((m) => [m.from, ...m.to]));
|
|
113
113
|
return new Set(peopleIn(seen, named));
|
|
114
114
|
});
|
|
115
|
-
// What it writes shows as it comes: the turn's live document.
|
|
116
|
-
|
|
115
|
+
// What it writes shows as it comes: the turn's live document. Offered no tools (or only those
|
|
116
|
+
// called beside an answer, `aside`), every step is an answer: a contact may read its words as
|
|
117
|
+
// they come too.
|
|
118
|
+
const tools = (ctx.resources.tools ?? {});
|
|
119
|
+
const live = liveWriter(ctx, t, run, current.in, offered.every((tool) => tools[tool.name]?.aside === true));
|
|
117
120
|
// Asked once a run: a change reaches its next reply, never a step halfway.
|
|
118
121
|
const model = await modelFor(ctx, t.agent, agent, current.in);
|
|
119
122
|
const { maxSteps } = settingsOf(ctx);
|
|
@@ -4,9 +4,18 @@ import { validator, } from "../../../../runtime/mod.js";
|
|
|
4
4
|
export const NO_ANSWER = { writeConcern: { w: 0 } };
|
|
5
5
|
export const HISTORY = 50;
|
|
6
6
|
export const SEND = "send_message";
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Message order is `at` order, so timestamps never repeat within a process. A clock set back
|
|
9
|
+
* (a step, a test's time travel) is followed, not outwaited: only a few ms ahead of it can be
|
|
10
|
+
* this counter's own, in a burst.
|
|
11
|
+
*/
|
|
8
12
|
let last = 0;
|
|
9
|
-
|
|
13
|
+
const SKEW = 1_000;
|
|
14
|
+
export const now = () => {
|
|
15
|
+
const clock = Date.now();
|
|
16
|
+
last = clock > last || last - clock > SKEW ? clock : last + 1;
|
|
17
|
+
return new Date(last).toISOString();
|
|
18
|
+
};
|
|
10
19
|
/** The agents the app declares (its `agents` resource). */
|
|
11
20
|
export const agentsOf = (ctx) => (ctx.resources.agents ?? {});
|
|
12
21
|
const sourcesOf = (ctx) => Object.values((ctx.resources.agentSources ?? {}));
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* before its first token). Before the commit that writes what the step
|
|
5
5
|
* became, it stops (`settle`), and that commit removes the document (`done`).
|
|
6
6
|
* When the model's call breaks and is tried again (`retry`), it says when,
|
|
7
|
-
* and keeps what it showed until the new attempt writes something.
|
|
7
|
+
* and keeps what it showed until the new attempt writes something. A turn
|
|
8
|
+
* that offers no tools only answers: its documents say so (`open`), and a
|
|
9
|
+
* contact reads their words as they come (see collections/live.ts).
|
|
8
10
|
*/
|
|
9
11
|
import type { Context, TransactionScope } from "../../../../runtime/mod.js";
|
|
10
12
|
import type { LiveCall } from "../collections/live.js";
|
|
@@ -30,4 +32,4 @@ export type LiveWriter = {
|
|
|
30
32
|
/** In the step's commit: removes the document. The next step starts a new one. */
|
|
31
33
|
done(tx: TransactionScope): Promise<unknown>;
|
|
32
34
|
};
|
|
33
|
-
export declare function liveWriter(ctx: Context, t: Turn, run: string, space?: string): LiveWriter;
|
|
35
|
+
export declare function liveWriter(ctx: Context, t: Turn, run: string, space?: string, open?: boolean): LiveWriter;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NO_ANSWER, now } from "./agents.js";
|
|
2
2
|
/** How often a turn's live document is written, at most (ms). */
|
|
3
3
|
export const LIVE_MS = 50;
|
|
4
|
-
export function liveWriter(ctx, t, run, space) {
|
|
4
|
+
export function liveWriter(ctx, t, run, space, open = false) {
|
|
5
5
|
const live = ctx.db.collection("live");
|
|
6
6
|
let doc = fresh();
|
|
7
7
|
let timer;
|
|
@@ -14,6 +14,7 @@ export function liveWriter(ctx, t, run, space) {
|
|
|
14
14
|
turn: run,
|
|
15
15
|
text: "",
|
|
16
16
|
calls: [],
|
|
17
|
+
...(open ? { open: true } : {}),
|
|
17
18
|
...(space ? { in: space } : {}),
|
|
18
19
|
at: now(),
|
|
19
20
|
};
|
|
@@ -52,6 +52,13 @@ export type Tool<I = Record<string, unknown>> = {
|
|
|
52
52
|
title?: string;
|
|
53
53
|
/** What it does to the world, for whoever decides how to call it (see `ToolAnnotations`). */
|
|
54
54
|
annotations?: ToolAnnotations;
|
|
55
|
+
/**
|
|
56
|
+
* Called beside an answer, never for what it tells the model (hanging up a
|
|
57
|
+
* call once the answer is said): a turn offered no tools but these is all
|
|
58
|
+
* answers, so a contact reads (and a caller hears) its words as they're
|
|
59
|
+
* written (`live.open`), as with no tools at all.
|
|
60
|
+
*/
|
|
61
|
+
aside?: boolean;
|
|
55
62
|
};
|
|
56
63
|
/**
|
|
57
64
|
* What a tool does to the world, as hints for whoever calls it: a model
|
|
@@ -97,6 +104,7 @@ export declare const tool: <const S extends JSONSchema>(def: {
|
|
|
97
104
|
offer?: Offer;
|
|
98
105
|
title?: string;
|
|
99
106
|
annotations?: ToolAnnotations;
|
|
107
|
+
aside?: boolean;
|
|
100
108
|
}) => Tool;
|
|
101
109
|
/** Chat's settings: the `chat` resource, which an app patches (`resources: { chat: { maxHops: 3 } }`). */
|
|
102
110
|
export type ChatSettings = {
|
|
@@ -157,16 +157,16 @@ export declare const outline: {
|
|
|
157
157
|
queries?: Record<string, import("../../../../runtime/define.js").QueryDef<{
|
|
158
158
|
[x: string]: unknown;
|
|
159
159
|
complete?: boolean | undefined;
|
|
160
|
-
last?: string | undefined;
|
|
161
160
|
since?: string | undefined;
|
|
161
|
+
last?: string | undefined;
|
|
162
162
|
tailIds?: string[] | undefined;
|
|
163
163
|
tailSteps?: boolean[] | undefined;
|
|
164
164
|
cutAt?: string | undefined;
|
|
165
165
|
count: number;
|
|
166
166
|
bytes: number;
|
|
167
|
+
tail: number[];
|
|
167
168
|
lines: unknown[];
|
|
168
169
|
boundary: number;
|
|
169
|
-
tail: number[];
|
|
170
170
|
tailAt: string[];
|
|
171
171
|
} & {
|
|
172
172
|
_id: string;
|
|
@@ -115,6 +115,8 @@ export async function withFiles(ctx, settings, operation, result) {
|
|
|
115
115
|
data: f.data,
|
|
116
116
|
thread: ctx.thread,
|
|
117
117
|
...(thread?.in ? { in: thread.in } : {}),
|
|
118
|
+
// A tool's output, as its step is: a contact in the conversation never reads it.
|
|
119
|
+
private: true,
|
|
118
120
|
at: new Date().toISOString(),
|
|
119
121
|
}, { upsert: true });
|
|
120
122
|
}
|
|
@@ -127,6 +127,7 @@ export declare const routine: {
|
|
|
127
127
|
paused?: string | undefined;
|
|
128
128
|
updated?: string | undefined;
|
|
129
129
|
next?: string | undefined;
|
|
130
|
+
since?: string | undefined;
|
|
130
131
|
last?: {
|
|
131
132
|
[x: string]: unknown;
|
|
132
133
|
error?: string | undefined;
|
|
@@ -135,7 +136,6 @@ export declare const routine: {
|
|
|
135
136
|
at: string;
|
|
136
137
|
} | undefined;
|
|
137
138
|
thread?: string | undefined;
|
|
138
|
-
since?: string | undefined;
|
|
139
139
|
rev?: number | undefined;
|
|
140
140
|
runs?: number | undefined;
|
|
141
141
|
chatName?: string | undefined;
|
|
@@ -368,8 +368,8 @@ export declare const billingPlan: {
|
|
|
368
368
|
[x: string]: unknown;
|
|
369
369
|
channel?: string | undefined;
|
|
370
370
|
status?: string | undefined;
|
|
371
|
-
budget?: number | null | undefined;
|
|
372
371
|
ended?: string[] | undefined;
|
|
372
|
+
budget?: number | null | undefined;
|
|
373
373
|
seats?: number | undefined;
|
|
374
374
|
subscription?: string | undefined;
|
|
375
375
|
waived?: {
|
|
@@ -397,8 +397,8 @@ export declare const billingPlan: {
|
|
|
397
397
|
statusAt?: string | undefined;
|
|
398
398
|
at: string;
|
|
399
399
|
name: string;
|
|
400
|
-
anchor: string;
|
|
401
400
|
since: string;
|
|
401
|
+
anchor: string;
|
|
402
402
|
terms: {
|
|
403
403
|
[x: string]: unknown;
|
|
404
404
|
for?: "personal" | "team" | undefined;
|
|
@@ -75,9 +75,9 @@ export declare const billingRoom: {
|
|
|
75
75
|
limit?: number | undefined;
|
|
76
76
|
lowCredits?: number | undefined;
|
|
77
77
|
lowBudget?: number | undefined;
|
|
78
|
-
until: string;
|
|
79
78
|
budget: number;
|
|
80
79
|
credits: number;
|
|
80
|
+
until: string;
|
|
81
81
|
} & {
|
|
82
82
|
_id: string;
|
|
83
83
|
}>> | undefined;
|
|
@@ -197,12 +197,12 @@ export declare const usageRollup: {
|
|
|
197
197
|
} | undefined;
|
|
198
198
|
unpriced?: string[] | undefined;
|
|
199
199
|
n: number;
|
|
200
|
+
meter: string;
|
|
201
|
+
subject: string;
|
|
200
202
|
quantities: {
|
|
201
203
|
[x: string]: number;
|
|
202
204
|
};
|
|
203
|
-
meter: string;
|
|
204
205
|
day: string;
|
|
205
|
-
subject: string;
|
|
206
206
|
} & {
|
|
207
207
|
_id: string;
|
|
208
208
|
}>> | undefined;
|
|
@@ -213,11 +213,11 @@ export declare const usage: {
|
|
|
213
213
|
unpriced?: string[] | undefined;
|
|
214
214
|
adjusts?: string | undefined;
|
|
215
215
|
at: string;
|
|
216
|
+
meter: string;
|
|
217
|
+
subject: string;
|
|
216
218
|
quantities: {
|
|
217
219
|
[x: string]: number;
|
|
218
220
|
};
|
|
219
|
-
meter: string;
|
|
220
|
-
subject: string;
|
|
221
221
|
} & {
|
|
222
222
|
_id: string;
|
|
223
223
|
}>> | undefined;
|
|
@@ -40,6 +40,8 @@ async function seen(ctx, vm, state) {
|
|
|
40
40
|
return null;
|
|
41
41
|
}
|
|
42
42
|
export const poolAdmitAction = defineAction({
|
|
43
|
+
// Unrecorded: its input is the VM's identity token, which admits it.
|
|
44
|
+
record: false,
|
|
43
45
|
input: {
|
|
44
46
|
type: "object",
|
|
45
47
|
properties: { secret: { type: "string" } },
|
|
@@ -9,14 +9,16 @@ import { defineAction } from "../../../../runtime/mod.js";
|
|
|
9
9
|
import { POOL_ACTIONS } from "../contract.js";
|
|
10
10
|
/** The forwarding Actions, by name: `pool.take`, `pool.serve`, `pool.stop`, `pool.drop`, `pool.renew`. */
|
|
11
11
|
export function remoteActions(call, org) {
|
|
12
|
-
const forward = (action, record = true) => defineAction({
|
|
12
|
+
const forward = (action, record = true, hidden = []) => defineAction({
|
|
13
13
|
...(record ? {} : { record: false }),
|
|
14
|
+
...(hidden.length ? { private: hidden } : {}),
|
|
14
15
|
input: { type: "object" },
|
|
15
16
|
run: (_ctx, input) => call(action, org !== undefined ? { ...input, org } : input),
|
|
16
17
|
});
|
|
17
18
|
return {
|
|
18
19
|
[POOL_ACTIONS.take]: forward(POOL_ACTIONS.take),
|
|
19
|
-
|
|
20
|
+
// What connects the computer stays out of the log, as the pool's own `pool.serve`.
|
|
21
|
+
[POOL_ACTIONS.serve]: forward(POOL_ACTIONS.serve, true, ["assign.code", "assign.secret"]),
|
|
20
22
|
[POOL_ACTIONS.stop]: forward(POOL_ACTIONS.stop),
|
|
21
23
|
[POOL_ACTIONS.drop]: forward(POOL_ACTIONS.drop),
|
|
22
24
|
[POOL_ACTIONS.renew]: forward(POOL_ACTIONS.renew, false),
|
|
@@ -120,6 +120,8 @@ export const takeAction = defineAction({
|
|
|
120
120
|
},
|
|
121
121
|
});
|
|
122
122
|
export const serveAction = defineAction({
|
|
123
|
+
// What connects the computer stays out of the log.
|
|
124
|
+
private: ["assign.code", "assign.secret"],
|
|
123
125
|
input: {
|
|
124
126
|
type: "object",
|
|
125
127
|
properties: { vm: { type: "string" }, assign: { type: "object" }, org: { type: "string" } },
|
|
@@ -56,11 +56,11 @@ export declare const poolVm: {
|
|
|
56
56
|
private?: string[];
|
|
57
57
|
queries?: Record<string, import("../../../../runtime/define.js").QueryDef<{
|
|
58
58
|
[x: string]: unknown;
|
|
59
|
-
until?: string | undefined;
|
|
60
59
|
released?: string | undefined;
|
|
61
60
|
computer?: string | undefined;
|
|
62
61
|
org?: string | undefined;
|
|
63
62
|
seen?: string | undefined;
|
|
63
|
+
until?: string | undefined;
|
|
64
64
|
taken?: string | undefined;
|
|
65
65
|
at: string;
|
|
66
66
|
size: string;
|
|
@@ -9,6 +9,8 @@ import { defineAction } from "../../../../runtime/mod.js";
|
|
|
9
9
|
import { deskIn } from "../shared/desks.js";
|
|
10
10
|
import { hash, same, secret } from "../shared/secret.js";
|
|
11
11
|
export const admitAction = defineAction({
|
|
12
|
+
// Unrecorded: its input is the computer's secret, or a code to connect one.
|
|
13
|
+
record: false,
|
|
12
14
|
input: {
|
|
13
15
|
type: "object",
|
|
14
16
|
properties: { secret: { type: "string" } },
|
|
@@ -16,6 +16,8 @@ import { settingsOf } from "../shared/settings.js";
|
|
|
16
16
|
import { must } from "../../../access/spaces/contract.js";
|
|
17
17
|
export const codeAction = defineAction({
|
|
18
18
|
description: "A one-time code to connect a computer to a space",
|
|
19
|
+
// Unrecorded: its result is the code, which connects a computer as the person.
|
|
20
|
+
record: false,
|
|
19
21
|
input: {
|
|
20
22
|
type: "object",
|
|
21
23
|
properties: { in: { type: "string" } },
|
|
@@ -12,6 +12,8 @@ import { defineAction } from "../../../../runtime/mod.js";
|
|
|
12
12
|
import { code, hash } from "../shared/secret.js";
|
|
13
13
|
import { settingsOf } from "../shared/settings.js";
|
|
14
14
|
export const enrollmentAction = defineAction({
|
|
15
|
+
// Recorded, so a retried wake gets the same code; the code itself stays out of the log.
|
|
16
|
+
private: ["code"],
|
|
15
17
|
input: {
|
|
16
18
|
type: "object",
|
|
17
19
|
properties: { computer: { type: "string" } },
|
|
@@ -32,6 +32,9 @@ const PANEL = {
|
|
|
32
32
|
const READS = new Set(["jobs.list", "jobs.logs", "files.list", "files.read", "search"]);
|
|
33
33
|
export const workAction = defineAction({
|
|
34
34
|
description: "Works on a space's computer, in its folder there",
|
|
35
|
+
// Unrecorded: what's typed and shown in a shell, files' contents and env values
|
|
36
|
+
// given over the space's pass through; they often hold secrets.
|
|
37
|
+
record: false,
|
|
35
38
|
input: {
|
|
36
39
|
type: "object",
|
|
37
40
|
properties: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** The computer program's version, as `computer.info` and `--version` say it, and its builds are named. */
|
|
2
|
-
export declare const VERSION = "1.0.0-rc.
|
|
2
|
+
export declare const VERSION = "1.0.0-rc.23";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** The computer program's version, as `computer.info` and `--version` say it, and its builds are named. */
|
|
2
|
-
export const VERSION = "1.0.0-rc.
|
|
2
|
+
export const VERSION = "1.0.0-rc.23";
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*
|
|
15
15
|
* ```ts
|
|
16
16
|
* plugins: [...plugins, await computerDownloads()]
|
|
17
|
-
* plugins: [...plugins, await computerDownloads({ dir: "dist/computer/1.0.0-rc.
|
|
17
|
+
* plugins: [...plugins, await computerDownloads({ dir: "dist/computer/1.0.0-rc.23" })]
|
|
18
18
|
* plugins: [...plugins, await computerDownloads({ url: "https://downloads.example.com/computer/" })]
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
@@ -64,8 +64,11 @@ const cookiesOf = (request, name) => (request.headers.get("cookie") ?? "").split
|
|
|
64
64
|
.map((c) => c.slice(name.length + 1));
|
|
65
65
|
/**
|
|
66
66
|
* A cookie the computer's server sets, for its preview's host alone: its
|
|
67
|
-
* `Domain` goes, so
|
|
68
|
-
* previews, apps).
|
|
67
|
+
* `Domain` goes, so its headers set no cookies on the domain's other hosts
|
|
68
|
+
* (other previews, apps). That doesn't stop a preview tossing cookies: its
|
|
69
|
+
* page's script can still set `document.cookie` with `Domain=<parent>`. What
|
|
70
|
+
* stops that is the app's cookies' `__Host-` names (an entrance's
|
|
71
|
+
* `hostOnly`, identity's session), which no other host can set.
|
|
69
72
|
*/
|
|
70
73
|
const hostOnly = (cookie) => cookie.replace(/;\s*domain=[^;]*/gi, "");
|
|
71
74
|
/**
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
* - **Read SQL**, one read-only statement (`runtime.maintenance.read`, the
|
|
19
19
|
* store's `inspect`): at most `limit` rows and `bytes`, cut off after
|
|
20
20
|
* `timeout`. On a PostgreSQL server, as a role of its own
|
|
21
|
-
* (`postgresStore({ maintenance: { url } })
|
|
21
|
+
* (`postgresStore({ maintenance: { url } })`), or, told so, as the
|
|
22
|
+
* store's own (`maintenance: { storeRole: true }`); the README's
|
|
23
|
+
* Maintenance says what each costs.
|
|
22
24
|
* - **Writes through the owner**: the collections' operations (insertOne…
|
|
23
25
|
* deleteMany, and find…aggregate), checked against their schemas, recorded
|
|
24
26
|
* as events, cached and heard by Processors like any write; and the
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
* - **Read SQL**, one read-only statement (`runtime.maintenance.read`, the
|
|
19
19
|
* store's `inspect`): at most `limit` rows and `bytes`, cut off after
|
|
20
20
|
* `timeout`. On a PostgreSQL server, as a role of its own
|
|
21
|
-
* (`postgresStore({ maintenance: { url } })
|
|
21
|
+
* (`postgresStore({ maintenance: { url } })`), or, told so, as the
|
|
22
|
+
* store's own (`maintenance: { storeRole: true }`); the README's
|
|
23
|
+
* Maintenance says what each costs.
|
|
22
24
|
* - **Writes through the owner**: the collections' operations (insertOne…
|
|
23
25
|
* deleteMany, and find…aggregate), checked against their schemas, recorded
|
|
24
26
|
* as events, cached and heard by Processors like any write; and the
|
|
@@ -7,5 +7,9 @@ export type Called = {
|
|
|
7
7
|
isError?: true;
|
|
8
8
|
ran: boolean;
|
|
9
9
|
again?: true;
|
|
10
|
+
/** What the tool returned, as it is, for a tool shown through a widget (16 KiB at most). */
|
|
11
|
+
output?: string;
|
|
12
|
+
/** A widget's own call (`app`), admitted: the route makes it. */
|
|
13
|
+
admitted?: true;
|
|
10
14
|
};
|
|
11
15
|
export declare const callAction: import("../../../../runtime/define.js").ActionDef;
|