@chipschat/protocol 0.0.0-stage → 1.0.1
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 +201 -0
- package/README.md +56 -2
- package/dist/generated/types.d.ts +4052 -0
- package/dist/generated/types.d.ts.map +1 -0
- package/dist/generated/types.js +7 -0
- package/dist/generated/types.js.map +1 -0
- package/dist/src/address.d.ts +106 -0
- package/dist/src/address.d.ts.map +1 -0
- package/dist/src/address.js +141 -0
- package/dist/src/address.js.map +1 -0
- package/dist/src/agent-context-windows.d.ts +235 -0
- package/dist/src/agent-context-windows.d.ts.map +1 -0
- package/dist/src/agent-context-windows.js +213 -0
- package/dist/src/agent-context-windows.js.map +1 -0
- package/dist/src/agent-heartbeats.d.ts +106 -0
- package/dist/src/agent-heartbeats.d.ts.map +1 -0
- package/dist/src/agent-heartbeats.js +111 -0
- package/dist/src/agent-heartbeats.js.map +1 -0
- package/dist/src/agent-models.d.ts +158 -0
- package/dist/src/agent-models.d.ts.map +1 -0
- package/dist/src/agent-models.js +171 -0
- package/dist/src/agent-models.js.map +1 -0
- package/dist/src/agent-place.d.ts +76 -0
- package/dist/src/agent-place.d.ts.map +1 -0
- package/dist/src/agent-place.js +80 -0
- package/dist/src/agent-place.js.map +1 -0
- package/dist/src/agents.d.ts +24 -0
- package/dist/src/agents.d.ts.map +1 -0
- package/dist/src/agents.js +58 -0
- package/dist/src/agents.js.map +1 -0
- package/dist/src/capabilities.d.ts +121 -0
- package/dist/src/capabilities.d.ts.map +1 -0
- package/dist/src/capabilities.js +120 -0
- package/dist/src/capabilities.js.map +1 -0
- package/dist/src/checklist.d.ts +19 -0
- package/dist/src/checklist.d.ts.map +1 -0
- package/dist/src/checklist.js +22 -0
- package/dist/src/checklist.js.map +1 -0
- package/dist/src/commands.d.ts +50 -0
- package/dist/src/commands.d.ts.map +1 -0
- package/dist/src/commands.js +274 -0
- package/dist/src/commands.js.map +1 -0
- package/dist/src/connectors.d.ts +90 -0
- package/dist/src/connectors.d.ts.map +1 -0
- package/dist/src/connectors.js +119 -0
- package/dist/src/connectors.js.map +1 -0
- package/dist/src/context-files.d.ts +304 -0
- package/dist/src/context-files.d.ts.map +1 -0
- package/dist/src/context-files.js +247 -0
- package/dist/src/context-files.js.map +1 -0
- package/dist/src/context.d.ts +369 -0
- package/dist/src/context.d.ts.map +1 -0
- package/dist/src/context.js +526 -0
- package/dist/src/context.js.map +1 -0
- package/dist/src/direct-asks.d.ts +36 -0
- package/dist/src/direct-asks.d.ts.map +1 -0
- package/dist/src/direct-asks.js +43 -0
- package/dist/src/direct-asks.js.map +1 -0
- package/dist/src/envelope.d.ts +70 -0
- package/dist/src/envelope.d.ts.map +1 -0
- package/dist/src/envelope.js +46 -0
- package/dist/src/envelope.js.map +1 -0
- package/dist/src/events/catalogue.d.ts +50 -0
- package/dist/src/events/catalogue.d.ts.map +1 -0
- package/dist/src/events/catalogue.js +70 -0
- package/dist/src/events/catalogue.js.map +1 -0
- package/dist/src/events/chips-to-harness.d.ts +37 -0
- package/dist/src/events/chips-to-harness.d.ts.map +1 -0
- package/dist/src/events/chips-to-harness.js +511 -0
- package/dist/src/events/chips-to-harness.js.map +1 -0
- package/dist/src/events/harness-to-chips.d.ts +38 -0
- package/dist/src/events/harness-to-chips.d.ts.map +1 -0
- package/dist/src/events/harness-to-chips.js +593 -0
- package/dist/src/events/harness-to-chips.js.map +1 -0
- package/dist/src/events/index.d.ts +6 -0
- package/dist/src/events/index.d.ts.map +1 -0
- package/dist/src/events/index.js +5 -0
- package/dist/src/events/index.js.map +1 -0
- package/dist/src/events/workspace.d.ts +222 -0
- package/dist/src/events/workspace.d.ts.map +1 -0
- package/dist/src/events/workspace.js +1039 -0
- package/dist/src/events/workspace.js.map +1 -0
- package/dist/src/exchange.d.ts +262 -0
- package/dist/src/exchange.d.ts.map +1 -0
- package/dist/src/exchange.js +413 -0
- package/dist/src/exchange.js.map +1 -0
- package/dist/src/first-names.d.ts +29 -0
- package/dist/src/first-names.d.ts.map +1 -0
- package/dist/src/first-names.js +80 -0
- package/dist/src/first-names.js.map +1 -0
- package/dist/src/frames.d.ts +526 -0
- package/dist/src/frames.d.ts.map +1 -0
- package/dist/src/frames.js +346 -0
- package/dist/src/frames.js.map +1 -0
- package/dist/src/harness-jobs.d.ts +313 -0
- package/dist/src/harness-jobs.d.ts.map +1 -0
- package/dist/src/harness-jobs.js +210 -0
- package/dist/src/harness-jobs.js.map +1 -0
- package/dist/src/ids/index.d.ts +3 -0
- package/dist/src/ids/index.d.ts.map +1 -0
- package/dist/src/ids/index.js +2 -0
- package/dist/src/ids/index.js.map +1 -0
- package/dist/src/ids/ulid.d.ts +96 -0
- package/dist/src/ids/ulid.d.ts.map +1 -0
- package/dist/src/ids/ulid.js +212 -0
- package/dist/src/ids/ulid.js.map +1 -0
- package/dist/src/index.d.ts +81 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +47 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/invite-link.d.ts +64 -0
- package/dist/src/invite-link.d.ts.map +1 -0
- package/dist/src/invite-link.js +99 -0
- package/dist/src/invite-link.js.map +1 -0
- package/dist/src/join.d.ts +188 -0
- package/dist/src/join.d.ts.map +1 -0
- package/dist/src/join.js +190 -0
- package/dist/src/join.js.map +1 -0
- package/dist/src/limits.d.ts +50 -0
- package/dist/src/limits.d.ts.map +1 -0
- package/dist/src/limits.js +106 -0
- package/dist/src/limits.js.map +1 -0
- package/dist/src/matters.d.ts +22 -0
- package/dist/src/matters.d.ts.map +1 -0
- package/dist/src/matters.js +26 -0
- package/dist/src/matters.js.map +1 -0
- package/dist/src/mentions.d.ts +63 -0
- package/dist/src/mentions.d.ts.map +1 -0
- package/dist/src/mentions.js +129 -0
- package/dist/src/mentions.js.map +1 -0
- package/dist/src/names.d.ts +58 -0
- package/dist/src/names.d.ts.map +1 -0
- package/dist/src/names.js +192 -0
- package/dist/src/names.js.map +1 -0
- package/dist/src/no-reply.d.ts +17 -0
- package/dist/src/no-reply.d.ts.map +1 -0
- package/dist/src/no-reply.js +48 -0
- package/dist/src/no-reply.js.map +1 -0
- package/dist/src/notifications.d.ts +81 -0
- package/dist/src/notifications.d.ts.map +1 -0
- package/dist/src/notifications.js +65 -0
- package/dist/src/notifications.js.map +1 -0
- package/dist/src/pages.d.ts +32 -0
- package/dist/src/pages.d.ts.map +1 -0
- package/dist/src/pages.js +32 -0
- package/dist/src/pages.js.map +1 -0
- package/dist/src/pairing.d.ts +99 -0
- package/dist/src/pairing.d.ts.map +1 -0
- package/dist/src/pairing.js +163 -0
- package/dist/src/pairing.js.map +1 -0
- package/dist/src/primitives.d.ts +267 -0
- package/dist/src/primitives.d.ts.map +1 -0
- package/dist/src/primitives.js +279 -0
- package/dist/src/primitives.js.map +1 -0
- package/dist/src/project.d.ts +335 -0
- package/dist/src/project.d.ts.map +1 -0
- package/dist/src/project.js +499 -0
- package/dist/src/project.js.map +1 -0
- package/dist/src/ranges.d.ts +31 -0
- package/dist/src/ranges.d.ts.map +1 -0
- package/dist/src/ranges.js +51 -0
- package/dist/src/ranges.js.map +1 -0
- package/dist/src/relay.d.ts +177 -0
- package/dist/src/relay.d.ts.map +1 -0
- package/dist/src/relay.js +147 -0
- package/dist/src/relay.js.map +1 -0
- package/dist/src/room-files.d.ts +146 -0
- package/dist/src/room-files.d.ts.map +1 -0
- package/dist/src/room-files.js +135 -0
- package/dist/src/room-files.js.map +1 -0
- package/dist/src/room-note.d.ts +213 -0
- package/dist/src/room-note.d.ts.map +1 -0
- package/dist/src/room-note.js +457 -0
- package/dist/src/room-note.js.map +1 -0
- package/dist/src/space-icons.d.ts +68 -0
- package/dist/src/space-icons.d.ts.map +1 -0
- package/dist/src/space-icons.js +142 -0
- package/dist/src/space-icons.js.map +1 -0
- package/dist/src/spend.d.ts +57 -0
- package/dist/src/spend.d.ts.map +1 -0
- package/dist/src/spend.js +94 -0
- package/dist/src/spend.js.map +1 -0
- package/dist/src/visibility.d.ts +170 -0
- package/dist/src/visibility.d.ts.map +1 -0
- package/dist/src/visibility.js +218 -0
- package/dist/src/visibility.js.map +1 -0
- package/fixtures/agent.asked.json +15 -0
- package/fixtures/agent.attached.json +15 -0
- package/fixtures/agent.deleted.json +16 -0
- package/fixtures/agent.fork.json +14 -0
- package/fixtures/agent.lock_set.json +13 -0
- package/fixtures/agent.registered.json +17 -0
- package/fixtures/agent.released.json +16 -0
- package/fixtures/agent.updated.json +14 -0
- package/fixtures/approval.executed.json +16 -0
- package/fixtures/approval.request.json +45 -0
- package/fixtures/approval.resolved.json +20 -0
- package/fixtures/approval.routed.json +20 -0
- package/fixtures/artifact.create.json +18 -0
- package/fixtures/attachment.fetched.json +15 -0
- package/fixtures/attachment.limits_set.json +15 -0
- package/fixtures/budget.warning.json +20 -0
- package/fixtures/checkpoint.json +16 -0
- package/fixtures/context.compacted.json +16 -0
- package/fixtures/context.usage.json +17 -0
- package/fixtures/exchange.limits_set.json +15 -0
- package/fixtures/exchange.set.json +13 -0
- package/fixtures/feedback.json +21 -0
- package/fixtures/frames/ack.json +6 -0
- package/fixtures/frames/context.edit.json +11 -0
- package/fixtures/frames/context_window.change.json +9 -0
- package/fixtures/frames/context_window.compact.json +8 -0
- package/fixtures/frames/error.json +6 -0
- package/fixtures/frames/event.json +20 -0
- package/fixtures/frames/events.json +39 -0
- package/fixtures/frames/folder.open.json +6 -0
- package/fixtures/frames/folder.open.page.json +7 -0
- package/fixtures/frames/folder.run.json +8 -0
- package/fixtures/frames/folder.run_state.json +12 -0
- package/fixtures/frames/heartbeat.change.json +10 -0
- package/fixtures/frames/hello.json +18 -0
- package/fixtures/frames/job.change.json +9 -0
- package/fixtures/frames/join.json +19 -0
- package/fixtures/frames/model.change.json +10 -0
- package/fixtures/frames/ping.json +4 -0
- package/fixtures/frames/pong.json +4 -0
- package/fixtures/frames/presence.json +12 -0
- package/fixtures/frames/receipt.json +5 -0
- package/fixtures/frames/restart.json +5 -0
- package/fixtures/frames/subscribe.json +6 -0
- package/fixtures/handoff.json +20 -0
- package/fixtures/harness.removed.json +15 -0
- package/fixtures/harness.transferred.json +15 -0
- package/fixtures/hello.json +61 -0
- package/fixtures/join.allowed.json +20 -0
- package/fixtures/join.denied.json +17 -0
- package/fixtures/lane.updated.json +17 -0
- package/fixtures/membership.added.json +16 -0
- package/fixtures/membership.removed.json +14 -0
- package/fixtures/membership.replaced.json +15 -0
- package/fixtures/message.deleted.json +15 -0
- package/fixtures/message.edited.json +15 -0
- package/fixtures/message.handed.json +14 -0
- package/fixtures/message.heard.json +14 -0
- package/fixtures/message.held.json +14 -0
- package/fixtures/message.hidden.json +14 -0
- package/fixtures/message.new.json +96 -0
- package/fixtures/message.overheard.json +22 -0
- package/fixtures/message.pinned.json +14 -0
- package/fixtures/message.post.json +14 -0
- package/fixtures/message.shown.json +14 -0
- package/fixtures/message.unpinned.json +14 -0
- package/fixtures/person.face_set.json +17 -0
- package/fixtures/person.joined.json +16 -0
- package/fixtures/person.removed.json +16 -0
- package/fixtures/person.renamed.json +14 -0
- package/fixtures/policy.updated.json +30 -0
- package/fixtures/project.changed.json +21 -0
- package/fixtures/question.answered.json +23 -0
- package/fixtures/question.ask.json +37 -0
- package/fixtures/receipt.json +15 -0
- package/fixtures/relay.set.json +12 -0
- package/fixtures/role.changed.json +15 -0
- package/fixtures/run.cancel.json +15 -0
- package/fixtures/run.completed.json +20 -0
- package/fixtures/run.failed.json +20 -0
- package/fixtures/run.pause.json +15 -0
- package/fixtures/run.plan.json +24 -0
- package/fixtures/run.requested.json +34 -0
- package/fixtures/run.resume.json +15 -0
- package/fixtures/run.started.json +33 -0
- package/fixtures/run.status.json +17 -0
- package/fixtures/run.steer.json +21 -0
- package/fixtures/session.ended.json +15 -0
- package/fixtures/session.renamed.json +15 -0
- package/fixtures/session.started.json +17 -0
- package/fixtures/space.claimed.json +15 -0
- package/fixtures/space.created.json +14 -0
- package/fixtures/space.erased.json +13 -0
- package/fixtures/space.lead_set.json +13 -0
- package/fixtures/space.lock_set.json +13 -0
- package/fixtures/space.spend_ceiling_set.json +13 -0
- package/fixtures/space.updated.json +14 -0
- package/fixtures/step.log.json +26 -0
- package/fixtures/task.json +22 -0
- package/fixtures/turn.passed.json +14 -0
- package/fixtures/usage.json +21 -0
- package/fixtures/workspace.renamed.json +13 -0
- package/generated/agent-connect.json +13966 -0
- package/generated/schema/agent.asked.json +114 -0
- package/generated/schema/agent.attached.json +465 -0
- package/generated/schema/agent.deleted.json +127 -0
- package/generated/schema/agent.fork.json +107 -0
- package/generated/schema/agent.lock_set.json +105 -0
- package/generated/schema/agent.registered.json +130 -0
- package/generated/schema/agent.released.json +129 -0
- package/generated/schema/agent.updated.json +151 -0
- package/generated/schema/approval.executed.json +125 -0
- package/generated/schema/approval.request.json +279 -0
- package/generated/schema/approval.resolved.json +162 -0
- package/generated/schema/approval.routed.json +185 -0
- package/generated/schema/artifact.create.json +206 -0
- package/generated/schema/attachment.fetched.json +114 -0
- package/generated/schema/attachment.limits_set.json +136 -0
- package/generated/schema/budget.warning.json +152 -0
- package/generated/schema/checkpoint.json +111 -0
- package/generated/schema/context.compacted.json +124 -0
- package/generated/schema/context.usage.json +120 -0
- package/generated/schema/exchange.limits_set.json +127 -0
- package/generated/schema/exchange.set.json +144 -0
- package/generated/schema/feedback.json +173 -0
- package/generated/schema/handoff.json +122 -0
- package/generated/schema/harness.removed.json +122 -0
- package/generated/schema/harness.transferred.json +117 -0
- package/generated/schema/hello.json +509 -0
- package/generated/schema/join.allowed.json +176 -0
- package/generated/schema/join.denied.json +150 -0
- package/generated/schema/lane.updated.json +223 -0
- package/generated/schema/membership.added.json +153 -0
- package/generated/schema/membership.removed.json +126 -0
- package/generated/schema/membership.replaced.json +106 -0
- package/generated/schema/message.deleted.json +105 -0
- package/generated/schema/message.edited.json +107 -0
- package/generated/schema/message.handed.json +111 -0
- package/generated/schema/message.heard.json +100 -0
- package/generated/schema/message.held.json +181 -0
- package/generated/schema/message.hidden.json +100 -0
- package/generated/schema/message.new.json +1369 -0
- package/generated/schema/message.overheard.json +701 -0
- package/generated/schema/message.pinned.json +100 -0
- package/generated/schema/message.post.json +290 -0
- package/generated/schema/message.shown.json +100 -0
- package/generated/schema/message.unpinned.json +100 -0
- package/generated/schema/person.face_set.json +134 -0
- package/generated/schema/person.joined.json +128 -0
- package/generated/schema/person.removed.json +133 -0
- package/generated/schema/person.renamed.json +114 -0
- package/generated/schema/policy.updated.json +277 -0
- package/generated/schema/project.changed.json +199 -0
- package/generated/schema/question.answered.json +154 -0
- package/generated/schema/question.ask.json +194 -0
- package/generated/schema/receipt.json +109 -0
- package/generated/schema/relay.set.json +99 -0
- package/generated/schema/role.changed.json +116 -0
- package/generated/schema/run.cancel.json +106 -0
- package/generated/schema/run.completed.json +139 -0
- package/generated/schema/run.failed.json +135 -0
- package/generated/schema/run.pause.json +106 -0
- package/generated/schema/run.plan.json +128 -0
- package/generated/schema/run.requested.json +309 -0
- package/generated/schema/run.resume.json +106 -0
- package/generated/schema/run.started.json +142 -0
- package/generated/schema/run.status.json +120 -0
- package/generated/schema/run.steer.json +163 -0
- package/generated/schema/session.ended.json +106 -0
- package/generated/schema/session.renamed.json +108 -0
- package/generated/schema/session.started.json +116 -0
- package/generated/schema/space.claimed.json +107 -0
- package/generated/schema/space.created.json +148 -0
- package/generated/schema/space.erased.json +129 -0
- package/generated/schema/space.lead_set.json +108 -0
- package/generated/schema/space.lock_set.json +99 -0
- package/generated/schema/space.spend_ceiling_set.json +102 -0
- package/generated/schema/space.updated.json +112 -0
- package/generated/schema/step.log.json +187 -0
- package/generated/schema/task.json +268 -0
- package/generated/schema/turn.passed.json +99 -0
- package/generated/schema/usage.json +155 -0
- package/generated/schema/workspace.renamed.json +107 -0
- package/generated/types.ts +4178 -0
- package/package.json +38 -3
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The sub-schemas events are built from. Each one exists because more than one event needs
|
|
3
|
+
* it, and each carries a description, because those descriptions become the documentation
|
|
4
|
+
* reference (technical-plan decision 13).
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { ID_PREFIXES } from "./ids/index.js";
|
|
8
|
+
const ULID = "[0-7][0-9A-HJKMNP-TV-Z]{25}";
|
|
9
|
+
/** A schema for one kind of prefixed ULID, for example `run_01K4...` (decision 11). */
|
|
10
|
+
export function id(kind) {
|
|
11
|
+
return z
|
|
12
|
+
.string()
|
|
13
|
+
.regex(new RegExp(`^${ID_PREFIXES[kind]}_${ULID}$`), `expected a ${kind} id`)
|
|
14
|
+
.describe(`A ${kind} identifier: \`${ID_PREFIXES[kind]}_\` followed by a ULID.`);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Who takes part in rooms without being a person: an agent (ADR 0087), or a harness written
|
|
18
|
+
* before agents, which is a member of rooms until the upgrade gives it one.
|
|
19
|
+
*/
|
|
20
|
+
export const agentId = z
|
|
21
|
+
.string()
|
|
22
|
+
.regex(new RegExp(`^(?:${ID_PREFIXES.agent}|${ID_PREFIXES.harness})_${ULID}$`), "expected an agent id")
|
|
23
|
+
.describe("An agent identifier (`agt_`, ADR 0087), or a harness's (`hrn_`) for one written before agents.");
|
|
24
|
+
/**
|
|
25
|
+
* Somebody in a room a message can be for (ADR 0204): an agent (`agentId`), or a person (`usr_`).
|
|
26
|
+
*/
|
|
27
|
+
export const memberId = z
|
|
28
|
+
.string()
|
|
29
|
+
.regex(new RegExp(`^(?:${ID_PREFIXES.agent}|${ID_PREFIXES.harness}|${ID_PREFIXES.person})_${ULID}$`), "expected an agent or a person id")
|
|
30
|
+
.describe("An agent identifier (`agt_`, or a harness's `hrn_` for one written before agents), or a person's (`usr_`).");
|
|
31
|
+
/** The kinds of participant: a person, an agent in rooms, and the harness behind agents. */
|
|
32
|
+
export const PARTICIPANT_KINDS = ["person", "harness", "agent"];
|
|
33
|
+
export const isoTimestamp = z.iso
|
|
34
|
+
.datetime({ offset: true })
|
|
35
|
+
.describe("An ISO 8601 timestamp, for example `2026-09-02T14:22:31.004Z`.");
|
|
36
|
+
/** Who caused an event. Every envelope says so; the audit log is a read of this field. */
|
|
37
|
+
export const actor = z
|
|
38
|
+
.object({
|
|
39
|
+
kind: z
|
|
40
|
+
.enum(["person", "harness", "agent", "system"])
|
|
41
|
+
.describe("Whether a person, a harness, one of a harness's agents or Chips itself acted."),
|
|
42
|
+
id: z.string().min(1).describe("The participant id, or `system` for Chips."),
|
|
43
|
+
harness_id: id("harness")
|
|
44
|
+
.optional()
|
|
45
|
+
.describe("For an agent: the harness it speaks through, whose budget and runs are the agent's (ADR 0087). Filled in by Chips."),
|
|
46
|
+
})
|
|
47
|
+
.describe("The participant an event is attributed to.");
|
|
48
|
+
/** A person, harness or agent as another party sees them, with the role Chips assigns. */
|
|
49
|
+
export const participantRef = z
|
|
50
|
+
.object({
|
|
51
|
+
participant_id: z.string().min(1).describe("The stable id of the sender."),
|
|
52
|
+
kind: z
|
|
53
|
+
.enum(PARTICIPANT_KINDS)
|
|
54
|
+
.describe("Whether the sender is a person or an agent (ADR 0087); `harness` for a harness written before agents, and for any agent as a harness that has not declared `agents` is told it."),
|
|
55
|
+
display_name: z.string().min(1).max(120).describe("The name to show."),
|
|
56
|
+
role: z
|
|
57
|
+
.enum(["owner", "member", "guest"])
|
|
58
|
+
.describe("The sender's standing in this space. Multi-user is Chips' job, not the harness's."),
|
|
59
|
+
workspace_role: z
|
|
60
|
+
.enum(["owner", "admin", "member", "guest"])
|
|
61
|
+
.optional()
|
|
62
|
+
.describe("A person's standing in the workspace (SEC-15): what a model should weigh the words by, since a guest's read as the owner's otherwise. `promptFor` says it after the name. Absent for an agent or a harness, and from a Chips before it said."),
|
|
63
|
+
})
|
|
64
|
+
.describe("A sender, as the receiving side sees them.");
|
|
65
|
+
/** The longest transcript an attachment carries: far more than five minutes of anyone talking. */
|
|
66
|
+
export const MAX_TRANSCRIPT_LENGTH = 50_000;
|
|
67
|
+
/**
|
|
68
|
+
* An attachment. Anything you can send a person you can send a harness, so this shape carries
|
|
69
|
+
* files, images, video and voice notes alike (decision 10).
|
|
70
|
+
*/
|
|
71
|
+
export const attachment = z
|
|
72
|
+
.object({
|
|
73
|
+
attachment_id: id("attachment"),
|
|
74
|
+
filename: z.string().min(1).max(255).describe("The name to show. Never trusted for its type."),
|
|
75
|
+
mime_type: z
|
|
76
|
+
.string()
|
|
77
|
+
.min(1)
|
|
78
|
+
.max(255)
|
|
79
|
+
.describe("Sniffed from the bytes on upload, not taken from the client."),
|
|
80
|
+
byte_size: z.int().nonnegative().describe("Size in bytes."),
|
|
81
|
+
sha256: z
|
|
82
|
+
.string()
|
|
83
|
+
.regex(/^[a-f0-9]{64}$/)
|
|
84
|
+
.describe("Lowercase hex digest. The store is content-addressed."),
|
|
85
|
+
width: z.int().positive().optional().describe("Pixels, for images and video."),
|
|
86
|
+
height: z.int().positive().optional().describe("Pixels, for images and video."),
|
|
87
|
+
duration_ms: z.int().nonnegative().optional().describe("Milliseconds, for audio and video."),
|
|
88
|
+
transcript: z
|
|
89
|
+
.string()
|
|
90
|
+
.min(1)
|
|
91
|
+
.max(MAX_TRANSCRIPT_LENGTH)
|
|
92
|
+
.optional()
|
|
93
|
+
.describe("What was said, for a voice note the server transcribed when it arrived (ADR 0054). Machine-heard: the person's words as best the server could make them out."),
|
|
94
|
+
replaces: id("attachment")
|
|
95
|
+
.optional()
|
|
96
|
+
.describe("The version of the room's file of this name that this one was made from (ADR 0099), from the post's `replaces`. Filled in by Chips; a value the sender writes is replaced."),
|
|
97
|
+
})
|
|
98
|
+
.describe("A file carried by a message.");
|
|
99
|
+
/** An attachment as it reaches a harness: with a URL it can actually fetch. */
|
|
100
|
+
export const signedAttachment = attachment
|
|
101
|
+
.extend({
|
|
102
|
+
url: z
|
|
103
|
+
.url()
|
|
104
|
+
.describe("A signed URL, bound to the requesting token: fetch it with that token as the bearer, since the URL alone is refused."),
|
|
105
|
+
url_expires_at: isoTimestamp.describe("Ten minutes from issue, by default (decision 10)."),
|
|
106
|
+
})
|
|
107
|
+
.describe("An attachment with a short-lived, token-bound URL.");
|
|
108
|
+
/** Where a claim came from. External sources are what make an action risky. */
|
|
109
|
+
export const source = z
|
|
110
|
+
.object({
|
|
111
|
+
kind: z.enum(["external", "internal"]).describe("Whether the source is outside the workspace."),
|
|
112
|
+
label: z
|
|
113
|
+
.string()
|
|
114
|
+
.min(1)
|
|
115
|
+
.max(200)
|
|
116
|
+
.describe("What to show in the receipt, for example `vendor website`."),
|
|
117
|
+
url: z.url().optional().describe("Where to look, when there is somewhere to look."),
|
|
118
|
+
})
|
|
119
|
+
.describe("A source a harness used, shown in the receipt and on approval cards.");
|
|
120
|
+
/**
|
|
121
|
+
* Risk classes. These are the flags the policy engine matches on (decision 8), so the list is
|
|
122
|
+
* closed: a new class is a protocol change, not a free-text string a harness invents.
|
|
123
|
+
*/
|
|
124
|
+
export const riskClass = z
|
|
125
|
+
.enum([
|
|
126
|
+
"external",
|
|
127
|
+
"external_communication",
|
|
128
|
+
"irreversible",
|
|
129
|
+
"destructive",
|
|
130
|
+
"financial",
|
|
131
|
+
"credential",
|
|
132
|
+
"privacy",
|
|
133
|
+
"legal",
|
|
134
|
+
])
|
|
135
|
+
.describe("A risk class the policy engine can match a rule against.");
|
|
136
|
+
/**
|
|
137
|
+
* What kind of call a step is (ADR 0162), so a tool whose name Chips has never read still draws
|
|
138
|
+
* as what it does. Closed for the same reason as the risk classes: each is a glyph and a few
|
|
139
|
+
* words in the apps, and a kind nobody draws would be a dot again.
|
|
140
|
+
*/
|
|
141
|
+
export const stepKind = z
|
|
142
|
+
.enum(["search", "web", "shell", "image", "memory", "edit", "file", "mail", "handoff", "other"])
|
|
143
|
+
.describe("What kind of call the step is: `search` looks something up, `web` reads a page, `shell` runs a command, `image` looks at a picture, `memory` reads or writes what the agent keeps, `edit` changes a file, `file` reads, lists or sends one, `mail` reads or drafts email, `handoff` hands the work to another agent, `other` none of these.");
|
|
144
|
+
/** The action a harness wants to take. `kind` is what policy rules glob against. */
|
|
145
|
+
export const action = z
|
|
146
|
+
.object({
|
|
147
|
+
kind: z
|
|
148
|
+
.string()
|
|
149
|
+
.regex(/^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+$/)
|
|
150
|
+
.max(120)
|
|
151
|
+
.describe("A dotted verb, for example `email.send` or `payment.transfer`. Policy rules glob on it."),
|
|
152
|
+
input: z.unknown().optional().describe("The arguments, shaped by the tool being called."),
|
|
153
|
+
external: z.boolean().optional().describe("True when the action leaves the workspace."),
|
|
154
|
+
irreversible: z.boolean().optional().describe("True when the action cannot be undone."),
|
|
155
|
+
money_usd: z.number().nonnegative().optional().describe("Amount at stake, in US dollars."),
|
|
156
|
+
})
|
|
157
|
+
.describe("An action a harness proposes to take.");
|
|
158
|
+
/** What a person is shown before they decide. A diff for a change, prose for a message. */
|
|
159
|
+
export const preview = z
|
|
160
|
+
.object({
|
|
161
|
+
format: z
|
|
162
|
+
.enum(["markdown", "plain", "diff", "json", "table"])
|
|
163
|
+
.describe("How to render the body."),
|
|
164
|
+
body: z.string().max(200_000).describe("The rendered preview."),
|
|
165
|
+
title: z.string().max(200).optional().describe("A heading for the card."),
|
|
166
|
+
})
|
|
167
|
+
.describe("What the approver sees before deciding.");
|
|
168
|
+
/**
|
|
169
|
+
* Who may answer an approval. `owner`, `role:<name>` and `lead` are resolved by Chips, so a
|
|
170
|
+
* harness never needs to know who is on shift; once resolved the list holds ids — a person's,
|
|
171
|
+
* or the lead harness's (M5.5).
|
|
172
|
+
*/
|
|
173
|
+
export const approverRef = z
|
|
174
|
+
.string()
|
|
175
|
+
.regex(/^(owner|any|lead|role:[a-z][a-z0-9_]*|usr_[0-9A-HJKMNP-TV-Z]{26}|hrn_[0-9A-HJKMNP-TV-Z]{26})$/)
|
|
176
|
+
.describe("`owner`, `any`, `lead`, `role:<name>`, or a specific person id; a lead harness's id once resolved.");
|
|
177
|
+
/** Autonomy levels L0 to L3 (blueprint: trust is a dial, not a switch). */
|
|
178
|
+
export const autonomyLevel = z
|
|
179
|
+
.union([z.literal(0), z.literal(1), z.literal(2), z.literal(3)])
|
|
180
|
+
.describe("0 observe, 1 ask first, 2 ask when it matters, 3 autonomous and report back. Presets that expand to rules.");
|
|
181
|
+
/** One policy rule. Rules read like sentences: `email.send to an external domain -> ask the owner`. */
|
|
182
|
+
export const policyRule = z
|
|
183
|
+
.object({
|
|
184
|
+
match: z
|
|
185
|
+
.string()
|
|
186
|
+
.min(1)
|
|
187
|
+
.max(120)
|
|
188
|
+
.describe("A glob over action kinds, for example `payment.*`."),
|
|
189
|
+
when: z
|
|
190
|
+
.object({
|
|
191
|
+
external: z.boolean().optional(),
|
|
192
|
+
irreversible: z.boolean().optional(),
|
|
193
|
+
money_usd_over: z.number().nonnegative().optional(),
|
|
194
|
+
risk: z.array(riskClass).max(8).optional(),
|
|
195
|
+
starts_with: z
|
|
196
|
+
.array(z.string().min(1).max(400))
|
|
197
|
+
.min(1)
|
|
198
|
+
.max(8)
|
|
199
|
+
.optional()
|
|
200
|
+
.describe("For an action that carries a command (ADR 0239): the words a part of it starts with. A command goes ahead on such rules only when every part starts with one that allows it."),
|
|
201
|
+
})
|
|
202
|
+
.optional()
|
|
203
|
+
.describe("Extra conditions on the action's flags, and for a command, how its parts start."),
|
|
204
|
+
decision: z.enum(["allow", "ask", "deny"]).describe("What to do when the rule matches."),
|
|
205
|
+
approvers: z
|
|
206
|
+
.array(approverRef)
|
|
207
|
+
.max(16)
|
|
208
|
+
.optional()
|
|
209
|
+
.describe("Who may answer, when the decision is `ask`."),
|
|
210
|
+
reason: z
|
|
211
|
+
.string()
|
|
212
|
+
.max(400)
|
|
213
|
+
.optional()
|
|
214
|
+
.describe("Shown to the harness, and recorded in the audit log."),
|
|
215
|
+
off: z
|
|
216
|
+
.boolean()
|
|
217
|
+
.optional()
|
|
218
|
+
.describe("Turned off by a person (ADR 0195): kept in the list to turn back on, and skipped by the policy engine until then."),
|
|
219
|
+
made_by: z
|
|
220
|
+
.string()
|
|
221
|
+
.min(1)
|
|
222
|
+
.max(120)
|
|
223
|
+
.optional()
|
|
224
|
+
.describe("Who made it by answering an ask with Always (ADR 0195). Filled in by Chips."),
|
|
225
|
+
made_at: isoTimestamp
|
|
226
|
+
.optional()
|
|
227
|
+
.describe("When a person's answer made it (ADR 0195): Always, or This session. Filled in by Chips. A rule a person's answer made never allows an action that matters."),
|
|
228
|
+
})
|
|
229
|
+
.describe("A rule the policy engine evaluates.");
|
|
230
|
+
export const policy = z
|
|
231
|
+
.object({
|
|
232
|
+
autonomy: autonomyLevel,
|
|
233
|
+
rules: z
|
|
234
|
+
.array(policyRule)
|
|
235
|
+
.max(200)
|
|
236
|
+
.describe("Evaluated in order; the workspace cap always wins."),
|
|
237
|
+
})
|
|
238
|
+
.describe("A harness's autonomy level and the rules that fill in the details.");
|
|
239
|
+
/** Money is always an estimate and always labelled as one (blueprint: cost rolls up the trail). */
|
|
240
|
+
export const cost = z
|
|
241
|
+
.object({
|
|
242
|
+
usd: z.number().nonnegative().describe("An estimate, in US dollars."),
|
|
243
|
+
estimated: z.literal(true).describe("Always true. Cost is never presented as exact."),
|
|
244
|
+
})
|
|
245
|
+
.describe("An estimated cost.");
|
|
246
|
+
export const budget = z
|
|
247
|
+
.object({
|
|
248
|
+
limit_usd: z.number().nonnegative().describe("The ceiling for this harness."),
|
|
249
|
+
spent_usd: z.number().nonnegative().describe("Spent so far, estimated."),
|
|
250
|
+
})
|
|
251
|
+
.describe("A harness's budget. Warns at 80 percent, pauses the run at 100.");
|
|
252
|
+
/** How work travelled to get here, so a lane can be traced back to the message that caused it. */
|
|
253
|
+
export const trailEntry = z
|
|
254
|
+
.object({
|
|
255
|
+
participant_id: z.string().min(1).describe("Who handled this hop."),
|
|
256
|
+
run_id: id("run").optional().describe("The run this hop belongs to."),
|
|
257
|
+
goal: z.string().max(2000).optional().describe("What was asked at this hop."),
|
|
258
|
+
})
|
|
259
|
+
.describe("One hop in the chain that led to this work.");
|
|
260
|
+
/**
|
|
261
|
+
* A pointer to one visit a harness made to a space: `scout:<session_id>`, and whatever
|
|
262
|
+
* the harness calls it elsewhere. A space outlives its sessions (ADR 0024), so this is what
|
|
263
|
+
* tells one visit's runs from another's, and what lets a person open the harness's own
|
|
264
|
+
* transcript of it.
|
|
265
|
+
*/
|
|
266
|
+
export const sessionRef = z
|
|
267
|
+
.string()
|
|
268
|
+
.min(1)
|
|
269
|
+
.max(500)
|
|
270
|
+
.describe("The harness's own name for one visit, prefixed by the kind of harness.");
|
|
271
|
+
/**
|
|
272
|
+
* A person's standing in the workspace, as distinct from their standing in a room (ADR 0034).
|
|
273
|
+
* An owner does everything; an admin everything but touch an owner or make one; a member the
|
|
274
|
+
* ordinary things; a guest is in one space only and changes nothing about the workspace.
|
|
275
|
+
*/
|
|
276
|
+
export const workspaceRole = z
|
|
277
|
+
.enum(["owner", "admin", "member", "guest"])
|
|
278
|
+
.describe("Owner, admin, member or guest of the workspace: what a person may do here.");
|
|
279
|
+
//# sourceMappingURL=primitives.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitives.js","sourceRoot":"","sources":["../../src/primitives.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAe,MAAM,gBAAgB,CAAC;AAE1D,MAAM,IAAI,GAAG,6BAA6B,CAAC;AAE3C,uFAAuF;AACvF,MAAM,UAAU,EAAE,CAAmB,IAAO;IAC1C,OAAO,CAAC;SACL,MAAM,EAAE;SACR,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,EAAE,cAAc,IAAI,KAAK,CAAC;SAC5E,QAAQ,CAAC,KAAK,IAAI,kBAAkB,WAAW,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;AACrF,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC;KACrB,MAAM,EAAE;KACR,KAAK,CAC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;IACnE,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;IACrE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;CAC9E,CAAC;KACD,QAAQ,CAAC,6CAA6C,CAAC,CAAC;AAG3D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC;KACxB,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,GAAG,CAAC;KACR,QAAQ,CAAC,wEAAwE,CAAC,CAAC;AAEtF;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC;KAC3B,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;KAC3C,QAAQ,CAAC,4EAA4E,CAAC,CAAC"}
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A room's project (ADR 0220): one git repository per room, which Chips holds and serves over
|
|
3
|
+
* git's own smart HTTP. Every agent in the room works in a clone of its own, and its bridge does
|
|
4
|
+
* the git (ADR 0221); a person's device clones it with a token that holds for ten minutes.
|
|
5
|
+
*
|
|
6
|
+
* - **One branch.** `main`, which a push may move forward and never rewrite or delete.
|
|
7
|
+
* - **Who.** A harness, for one of its agents in the room, named in `chips-actor`; or a person in
|
|
8
|
+
* the room, with a project token from `POST /v1/spaces/:id/project/token`.
|
|
9
|
+
* - **What it won't keep.** A secrets file (`.env`, `.env.local`), anything that looks like a
|
|
10
|
+
* key, and a file over the workspace's cap for files.
|
|
11
|
+
*
|
|
12
|
+
* The server, the conformance fake and the SDK name the same paths and the same header, and look
|
|
13
|
+
* for secrets the same way, so those live here.
|
|
14
|
+
*/
|
|
15
|
+
import { z } from "zod";
|
|
16
|
+
/** The one branch a room's project has. */
|
|
17
|
+
export declare const PROJECT_BRANCH = "main";
|
|
18
|
+
/** Where a room's project is served: what a clone's remote URL ends in. */
|
|
19
|
+
export declare function projectPath(spaceId: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* The room a request to its project names, and what follows `project.git`; nothing when the path
|
|
22
|
+
* is not a project's.
|
|
23
|
+
*/
|
|
24
|
+
export declare function projectRequest(path: string): {
|
|
25
|
+
spaceId: string;
|
|
26
|
+
rest: string;
|
|
27
|
+
} | undefined;
|
|
28
|
+
/** The header a harness names the agent it fetches or pushes for with (ADR 0087). */
|
|
29
|
+
export declare const PROJECT_ACTOR_HEADER = "chips-actor";
|
|
30
|
+
/** The oldest git that takes a token through its environment (`GIT_CONFIG_COUNT`). */
|
|
31
|
+
export declare const PROJECT_GIT_VERSION = "2.31.0";
|
|
32
|
+
/** How long a person's project token holds. */
|
|
33
|
+
export declare const PROJECT_TOKEN_TTL_SECONDS = 600;
|
|
34
|
+
/** The prefix a project token wears, as a harness token wears `chips_at_`. */
|
|
35
|
+
export declare const PROJECT_TOKEN_PREFIX = "chips_pt_";
|
|
36
|
+
/** `POST /v1/spaces/:id/project/token`'s answer. */
|
|
37
|
+
export declare const projectToken: z.ZodObject<{
|
|
38
|
+
token: z.ZodString;
|
|
39
|
+
expires_at: z.ZodISODateTime;
|
|
40
|
+
path: z.ZodString;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
export type ProjectToken = z.infer<typeof projectToken>;
|
|
43
|
+
/**
|
|
44
|
+
* `POST /v1/spaces/:id/project/folder/open`'s answer (ADR 0225): how many of the person's own
|
|
45
|
+
* Macs were sent `folder.open`. Nought means Chips for Mac isn't open anywhere.
|
|
46
|
+
*/
|
|
47
|
+
export declare const projectFolderOpenAnswer: z.ZodObject<{
|
|
48
|
+
macs: z.ZodInt;
|
|
49
|
+
opened_app: z.ZodOptional<z.ZodLiteral<true>>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
export type ProjectFolderOpenAnswer = z.infer<typeof projectFolderOpenAnswer>;
|
|
52
|
+
/**
|
|
53
|
+
* The agents' and Chips's own folder at the project's top (ADR 0227): the start page and the run
|
|
54
|
+
* file. Files leaves it out, and Finder hides it as it hides `.git`.
|
|
55
|
+
*/
|
|
56
|
+
export declare const CHIPS_FOLDER = ".chips";
|
|
57
|
+
/** The file that says how the project runs on the person's Mac (ADRs 0226, 0227). */
|
|
58
|
+
export declare const RUN_FILE = ".chips/run.json";
|
|
59
|
+
/** Where the run file was kept before ADR 0227, read when there is no `RUN_FILE`. */
|
|
60
|
+
export declare const RUN_FILE_BEFORE = "chips.json";
|
|
61
|
+
/** The page that links to the documents worth seeing, which Universe opens (ADR 0227). */
|
|
62
|
+
export declare const START_PAGE = ".chips/index.html";
|
|
63
|
+
/**
|
|
64
|
+
* What a link to a file of the project becomes when chipsd builds a page (ADR 0227): this, then the
|
|
65
|
+
* path, encoded as a URI component. The phone's page view opens the file over the page; in a frame,
|
|
66
|
+
* the builder's script hands the path to the window as `{chipsFile: path}`.
|
|
67
|
+
*/
|
|
68
|
+
export declare const FILE_LINK = "chips-file:";
|
|
69
|
+
/** How a project runs, as its agents wrote it in its run file. */
|
|
70
|
+
export interface RunRecipe {
|
|
71
|
+
/**
|
|
72
|
+
* One shell command, run in the project's folder: a server that stays up, or a script that ends.
|
|
73
|
+
* None for pages that need no starting: Run only opens `opens`, a file of the project.
|
|
74
|
+
*/
|
|
75
|
+
readonly run?: string | undefined;
|
|
76
|
+
/** An address on the Mac, or a file of the project, opened once the run answers. */
|
|
77
|
+
readonly opens?: string | undefined;
|
|
78
|
+
/** Run first, and waited for, whenever it or the project's package files changed. */
|
|
79
|
+
readonly setup?: string | undefined;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The run file's recipe, or why it isn't one: the Mac reads it before it runs anything, and the
|
|
83
|
+
* phone and the web read it to show what Run does. `opens` is never somewhere on the internet.
|
|
84
|
+
* `file` is the run file it was read from, which its words name.
|
|
85
|
+
*/
|
|
86
|
+
export declare function runRecipe(text: string, file?: string): RunRecipe | {
|
|
87
|
+
readonly why: string;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* What a press runs, as the Mac compares it with its folder's run file: setup, then run, then
|
|
91
|
+
* `open` and what it opens. What it opens is part of it, so a run file that changed only where it
|
|
92
|
+
* opens is shown again before it runs (SEC-46).
|
|
93
|
+
*/
|
|
94
|
+
export declare function commandOf(recipe: RunRecipe): string;
|
|
95
|
+
/**
|
|
96
|
+
* Whether opening a path runs a program, by its last part once `.`, `..` and slashes are settled
|
|
97
|
+
* as the Mac settles them: `play.command/.` is `play.command` (SEC-46). The Mac asks again of the
|
|
98
|
+
* file it opens, after links.
|
|
99
|
+
*/
|
|
100
|
+
export declare function opensAProgram(path: string): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* What Run shows of `opens`: `localhost:8000`, or the file's name. An address of this Mac's own,
|
|
103
|
+
* `127.0.0.1` or `[::1]`, which Run opens to reach exactly where a program listens (ADR 0230),
|
|
104
|
+
* reads as `localhost`.
|
|
105
|
+
*/
|
|
106
|
+
export declare function opensShown(opens: string): string;
|
|
107
|
+
/** A run of the room's project on the person's Mac (ADR 0226), as that Mac tells it. */
|
|
108
|
+
export declare const projectRun: z.ZodObject<{
|
|
109
|
+
state: z.ZodEnum<{
|
|
110
|
+
never: "never";
|
|
111
|
+
running: "running";
|
|
112
|
+
failed: "failed";
|
|
113
|
+
stopped: "stopped";
|
|
114
|
+
starting: "starting";
|
|
115
|
+
ended: "ended";
|
|
116
|
+
opened: "opened";
|
|
117
|
+
}>;
|
|
118
|
+
command: z.ZodOptional<z.ZodString>;
|
|
119
|
+
commit: z.ZodOptional<z.ZodString>;
|
|
120
|
+
since: z.ZodOptional<z.ZodISODateTime>;
|
|
121
|
+
ended: z.ZodOptional<z.ZodISODateTime>;
|
|
122
|
+
code: z.ZodOptional<z.ZodInt>;
|
|
123
|
+
opened: z.ZodOptional<z.ZodString>;
|
|
124
|
+
lines: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
125
|
+
why: z.ZodOptional<z.ZodString>;
|
|
126
|
+
trouble: z.ZodOptional<z.ZodString>;
|
|
127
|
+
}, z.core.$strip>;
|
|
128
|
+
export type ProjectRun = z.infer<typeof projectRun>;
|
|
129
|
+
/** A run as the server holds it for the person's other devices: which Mac said it, and when. */
|
|
130
|
+
export declare const heldRun: z.ZodObject<{
|
|
131
|
+
state: z.ZodEnum<{
|
|
132
|
+
never: "never";
|
|
133
|
+
running: "running";
|
|
134
|
+
failed: "failed";
|
|
135
|
+
stopped: "stopped";
|
|
136
|
+
starting: "starting";
|
|
137
|
+
ended: "ended";
|
|
138
|
+
opened: "opened";
|
|
139
|
+
}>;
|
|
140
|
+
command: z.ZodOptional<z.ZodString>;
|
|
141
|
+
commit: z.ZodOptional<z.ZodString>;
|
|
142
|
+
since: z.ZodOptional<z.ZodISODateTime>;
|
|
143
|
+
ended: z.ZodOptional<z.ZodISODateTime>;
|
|
144
|
+
code: z.ZodOptional<z.ZodInt>;
|
|
145
|
+
opened: z.ZodOptional<z.ZodString>;
|
|
146
|
+
lines: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
147
|
+
why: z.ZodOptional<z.ZodString>;
|
|
148
|
+
trouble: z.ZodOptional<z.ZodString>;
|
|
149
|
+
mac: z.ZodString;
|
|
150
|
+
said_at: z.ZodISODateTime;
|
|
151
|
+
}, z.core.$strip>;
|
|
152
|
+
export type HeldRun = z.infer<typeof heldRun>;
|
|
153
|
+
/**
|
|
154
|
+
* `GET /v1/spaces/:id/project/run`'s answer: how the person's last run of the room stands, as
|
|
155
|
+
* their Mac last said, and how many of their Macs are open now to run or stop it.
|
|
156
|
+
*/
|
|
157
|
+
export declare const projectRunAnswer: z.ZodObject<{
|
|
158
|
+
run: z.ZodOptional<z.ZodObject<{
|
|
159
|
+
state: z.ZodEnum<{
|
|
160
|
+
never: "never";
|
|
161
|
+
running: "running";
|
|
162
|
+
failed: "failed";
|
|
163
|
+
stopped: "stopped";
|
|
164
|
+
starting: "starting";
|
|
165
|
+
ended: "ended";
|
|
166
|
+
opened: "opened";
|
|
167
|
+
}>;
|
|
168
|
+
command: z.ZodOptional<z.ZodString>;
|
|
169
|
+
commit: z.ZodOptional<z.ZodString>;
|
|
170
|
+
since: z.ZodOptional<z.ZodISODateTime>;
|
|
171
|
+
ended: z.ZodOptional<z.ZodISODateTime>;
|
|
172
|
+
code: z.ZodOptional<z.ZodInt>;
|
|
173
|
+
opened: z.ZodOptional<z.ZodString>;
|
|
174
|
+
lines: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
175
|
+
why: z.ZodOptional<z.ZodString>;
|
|
176
|
+
trouble: z.ZodOptional<z.ZodString>;
|
|
177
|
+
mac: z.ZodString;
|
|
178
|
+
said_at: z.ZodISODateTime;
|
|
179
|
+
}, z.core.$strip>>;
|
|
180
|
+
macs: z.ZodInt;
|
|
181
|
+
}, z.core.$strip>;
|
|
182
|
+
export type ProjectRunAnswer = z.infer<typeof projectRunAnswer>;
|
|
183
|
+
/** A git object id: SHA-1, or SHA-256 for a repository made with it. */
|
|
184
|
+
export declare const commitId: z.ZodString;
|
|
185
|
+
/** The most files `project.changed` names; the rest are counted. */
|
|
186
|
+
export declare const PROJECT_CHANGED_FILES = 200;
|
|
187
|
+
export declare const projectChangedFile: z.ZodObject<{
|
|
188
|
+
path: z.ZodString;
|
|
189
|
+
added: z.ZodNullable<z.ZodInt>;
|
|
190
|
+
removed: z.ZodNullable<z.ZodInt>;
|
|
191
|
+
}, z.core.$strip>;
|
|
192
|
+
export declare const projectChangedPayload: z.ZodObject<{
|
|
193
|
+
by: z.ZodString;
|
|
194
|
+
before: z.ZodNullable<z.ZodString>;
|
|
195
|
+
after: z.ZodString;
|
|
196
|
+
commits: z.ZodInt;
|
|
197
|
+
message: z.ZodString;
|
|
198
|
+
files: z.ZodArray<z.ZodObject<{
|
|
199
|
+
path: z.ZodString;
|
|
200
|
+
added: z.ZodNullable<z.ZodInt>;
|
|
201
|
+
removed: z.ZodNullable<z.ZodInt>;
|
|
202
|
+
}, z.core.$strip>>;
|
|
203
|
+
more_files: z.ZodOptional<z.ZodInt>;
|
|
204
|
+
file_count: z.ZodOptional<z.ZodInt>;
|
|
205
|
+
undoes: z.ZodOptional<z.ZodString>;
|
|
206
|
+
}, z.core.$strip>;
|
|
207
|
+
/**
|
|
208
|
+
* A name that says a file holds secrets, `.env`, `.env.local` and the like, and the names of the
|
|
209
|
+
* examples people commit, `.env.example`, `.env.sample` and `.env.template`, which don't. Sources,
|
|
210
|
+
* as `SECRET_SHAPES` are.
|
|
211
|
+
*/
|
|
212
|
+
export declare const SECRETS_FILE: {
|
|
213
|
+
readonly source: "^\\.env(?:\\..+)?$";
|
|
214
|
+
readonly unless: "^\\.env\\.(?:example|sample|template)$";
|
|
215
|
+
};
|
|
216
|
+
/** Whether a file's name says it holds secrets, wherever it is in the project. */
|
|
217
|
+
export declare function isSecretsFile(path: string): boolean;
|
|
218
|
+
/**
|
|
219
|
+
* What a key looks like, by whose it is: the shapes a push is refused for. Sources, not
|
|
220
|
+
* expressions, since the server's check runs in git's hook, a process of its own.
|
|
221
|
+
*/
|
|
222
|
+
export declare const SECRET_SHAPES: readonly {
|
|
223
|
+
readonly what: string;
|
|
224
|
+
readonly source: string;
|
|
225
|
+
}[];
|
|
226
|
+
/** Whose key a file's words hold, by the first shape they match, or nothing. */
|
|
227
|
+
export declare function secretIn(text: string): string | undefined;
|
|
228
|
+
/**
|
|
229
|
+
* What an agent's copy never commits, written into the copy's own `info/exclude` (ADR 0221): what
|
|
230
|
+
* a build or a package manager makes, what macOS leaves, and secrets files, but not their examples.
|
|
231
|
+
*/
|
|
232
|
+
export declare const PROJECT_LEAVE_OUT: readonly string[];
|
|
233
|
+
/** What an agent's turn is told of its copy of the room's project, before the turn (ADR 0221). */
|
|
234
|
+
export interface ProjectFacts {
|
|
235
|
+
/** The copy, by its path on the agent's machine. */
|
|
236
|
+
readonly folder: string;
|
|
237
|
+
/** How many files the project has. */
|
|
238
|
+
readonly files: number;
|
|
239
|
+
/** What others changed since the agent's last turn, by path. */
|
|
240
|
+
readonly changed: readonly string[];
|
|
241
|
+
/** Who changed them, by name. */
|
|
242
|
+
readonly by: readonly string[];
|
|
243
|
+
/** Files left with both sides of a clash in them, for the agent to settle. */
|
|
244
|
+
readonly clashes: readonly string[];
|
|
245
|
+
/** Whose change they clashed with, by name. */
|
|
246
|
+
readonly clashedWith: readonly string[];
|
|
247
|
+
/** Files left out of the agent's last change, and why: a key, by whose it looks like. */
|
|
248
|
+
readonly keys: readonly {
|
|
249
|
+
readonly path: string;
|
|
250
|
+
readonly what: string;
|
|
251
|
+
}[];
|
|
252
|
+
/** Why the copy couldn't be brought up to date, when it couldn't. */
|
|
253
|
+
readonly trouble?: string | undefined;
|
|
254
|
+
/** Whether the project has Markdown files. */
|
|
255
|
+
readonly markdown: boolean;
|
|
256
|
+
/** Whether the project has an HTML page, which Chips builds into one document to open (ADR 0223). */
|
|
257
|
+
readonly pages?: boolean | undefined;
|
|
258
|
+
}
|
|
259
|
+
/** `a, b and c`, or the first six and how many more. */
|
|
260
|
+
export declare function namesInWords(names: readonly string[]): string;
|
|
261
|
+
/**
|
|
262
|
+
* The note an agent's turn opens its project with: where its copy is and that the bridge does the
|
|
263
|
+
* git, what others changed, a clash to settle or a key to take out, and, in a room with other
|
|
264
|
+
* agents, how to share the work. Its facts, then its asks (ADR 0250).
|
|
265
|
+
*/
|
|
266
|
+
export declare function renderProjectNote(facts: ProjectFacts, options: {
|
|
267
|
+
readonly othersInRoom: boolean;
|
|
268
|
+
}): string;
|
|
269
|
+
/**
|
|
270
|
+
* What a turn is told of its copy of the project (ADR 0221): where it is, what others changed, and
|
|
271
|
+
* a clash to settle or a key to take out. Said with every turn.
|
|
272
|
+
*/
|
|
273
|
+
export declare function renderProjectFacts(facts: ProjectFacts): string;
|
|
274
|
+
/**
|
|
275
|
+
* What the note asks of every turn: where to work, and how, for the room and the files it has. The
|
|
276
|
+
* same from turn to turn while the project and the room keep their shape, so a session that keeps
|
|
277
|
+
* its earlier turns may be told them once (ADR 0250).
|
|
278
|
+
*/
|
|
279
|
+
export declare function renderProjectAsks(facts: Pick<ProjectFacts, "markdown" | "pages">, options: {
|
|
280
|
+
readonly othersInRoom: boolean;
|
|
281
|
+
}): string;
|
|
282
|
+
/** A project file's media type, by its name: `text/plain` for code, `application/octet-stream` for the rest. */
|
|
283
|
+
export declare function projectFileType(path: string): string;
|
|
284
|
+
/** Whose a commit is, from the email Chips signs it with: an agent's or a person's id, or nothing. */
|
|
285
|
+
export declare function committerId(email: string): string | undefined;
|
|
286
|
+
/** `GET /v1/spaces/:id/project/files`: the project's files at `main` (ADR 0222). */
|
|
287
|
+
export interface ProjectFilesAnswer {
|
|
288
|
+
/** The commit they are at, or `null` before the project's first change. */
|
|
289
|
+
readonly at: string | null;
|
|
290
|
+
readonly files: readonly {
|
|
291
|
+
readonly path: string;
|
|
292
|
+
readonly bytes: number;
|
|
293
|
+
readonly type: string;
|
|
294
|
+
}[];
|
|
295
|
+
}
|
|
296
|
+
/** `GET /v1/spaces/:id/project/changes/:commit`: one change and its diff (ADR 0222). */
|
|
297
|
+
export interface ProjectChangeAnswer {
|
|
298
|
+
readonly commit: string;
|
|
299
|
+
readonly parent: string | null;
|
|
300
|
+
/** Who made it: their name as it was signed, and their id when Chips signed it. */
|
|
301
|
+
readonly by: {
|
|
302
|
+
readonly name: string;
|
|
303
|
+
readonly id?: string | undefined;
|
|
304
|
+
};
|
|
305
|
+
readonly at: string;
|
|
306
|
+
readonly message: string;
|
|
307
|
+
readonly files: readonly {
|
|
308
|
+
readonly path: string;
|
|
309
|
+
readonly added: number | null;
|
|
310
|
+
readonly removed: number | null;
|
|
311
|
+
/** The file's unified diff, or `null` for a binary file. */
|
|
312
|
+
readonly patch: string | null;
|
|
313
|
+
/** Whether the diff was cut short, the change being long. */
|
|
314
|
+
readonly cut: boolean;
|
|
315
|
+
}[];
|
|
316
|
+
readonly more_files?: number | undefined;
|
|
317
|
+
}
|
|
318
|
+
/** `GET /v1/spaces/:id/project/history?path=`: one file's changes, newest first (ADR 0222). */
|
|
319
|
+
export interface ProjectHistoryAnswer {
|
|
320
|
+
readonly path: string;
|
|
321
|
+
readonly versions: readonly {
|
|
322
|
+
readonly commit: string;
|
|
323
|
+
readonly by: {
|
|
324
|
+
readonly name: string;
|
|
325
|
+
readonly id?: string | undefined;
|
|
326
|
+
};
|
|
327
|
+
readonly at: string;
|
|
328
|
+
readonly message: string;
|
|
329
|
+
}[];
|
|
330
|
+
}
|
|
331
|
+
/** `POST /v1/spaces/:id/project/undo`: the change Undo made (ADR 0222). */
|
|
332
|
+
export interface ProjectUndoAnswer {
|
|
333
|
+
readonly after: string;
|
|
334
|
+
}
|
|
335
|
+
//# sourceMappingURL=project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/project.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,2CAA2C;AAC3C,eAAO,MAAM,cAAc,SAAS,CAAC;AAErC,2EAA2E;AAC3E,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAI1F;AAED,qFAAqF;AACrF,eAAO,MAAM,oBAAoB,gBAAgB,CAAC;AAElD,sFAAsF;AACtF,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAE5C,+CAA+C;AAC/C,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C,8EAA8E;AAC9E,eAAO,MAAM,oBAAoB,cAAc,CAAC;AAEhD,oDAAoD;AACpD,eAAO,MAAM,YAAY;;;;iBAavB,CA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