@chipschat/protocol 0.0.0-stage → 1.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/LICENSE +201 -0
- package/README.md +56 -2
- package/dist/envelope.d.ts +54 -0
- package/dist/envelope.d.ts.map +1 -0
- package/dist/envelope.js +48 -0
- package/dist/envelope.js.map +1 -0
- package/dist/events/agent-to-chips.d.ts +27 -0
- package/dist/events/agent-to-chips.d.ts.map +1 -0
- package/dist/events/agent-to-chips.js +392 -0
- package/dist/events/agent-to-chips.js.map +1 -0
- package/dist/events/catalogue.d.ts +48 -0
- package/dist/events/catalogue.d.ts.map +1 -0
- package/dist/events/catalogue.js +67 -0
- package/dist/events/catalogue.js.map +1 -0
- package/dist/events/chips-to-agent.d.ts +24 -0
- package/dist/events/chips-to-agent.d.ts.map +1 -0
- package/dist/events/chips-to-agent.js +324 -0
- package/dist/events/chips-to-agent.js.map +1 -0
- package/dist/events/chips-to-harness.d.ts +24 -0
- package/dist/events/chips-to-harness.d.ts.map +1 -0
- package/dist/events/chips-to-harness.js +324 -0
- package/dist/events/chips-to-harness.js.map +1 -0
- package/dist/events/harness-to-chips.d.ts +27 -0
- package/dist/events/harness-to-chips.d.ts.map +1 -0
- package/dist/events/harness-to-chips.js +390 -0
- package/dist/events/harness-to-chips.js.map +1 -0
- package/dist/events/index.d.ts +6 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +5 -0
- package/dist/events/index.js.map +1 -0
- package/dist/events/workspace.d.ts +19 -0
- package/dist/events/workspace.d.ts.map +1 -0
- package/dist/events/workspace.js +79 -0
- package/dist/events/workspace.js.map +1 -0
- package/dist/frames.d.ts +175 -0
- package/dist/frames.d.ts.map +1 -0
- package/dist/frames.js +161 -0
- package/dist/frames.js.map +1 -0
- 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/ids/index.d.ts +3 -0
- package/dist/ids/index.d.ts.map +1 -0
- package/dist/ids/index.js +2 -0
- package/dist/ids/index.js.map +1 -0
- package/dist/ids/ulid.d.ts +83 -0
- package/dist/ids/ulid.d.ts.map +1 -0
- package/dist/ids/ulid.js +199 -0
- package/dist/ids/ulid.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/primitives.d.ts +194 -0
- package/dist/primitives.d.ts.map +1 -0
- package/dist/primitives.js +193 -0
- package/dist/primitives.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 +37 -3
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A command an ask carries, read the way a shell would read it (ADR 0239), so that a standing yes
|
|
3
|
+
* remembers how each part of it starts rather than the whole kind of action. Here, so the server,
|
|
4
|
+
* the conformance kit's fake and the apps read a command the same way.
|
|
5
|
+
*
|
|
6
|
+
* A command is the ask's `input.command`: a string a shell runs, or an array of words a program
|
|
7
|
+
* runs as given. A string is split into parts at `&&`, `||`, `;`, `|` and new lines outside
|
|
8
|
+
* quotes, and each part into words, quotes taken off. A command that does more than this reader
|
|
9
|
+
* can follow is not read at all: a redirection (`>`, `<`), something run inside it (`$(`,
|
|
10
|
+
* backticks, `$`, parentheses, braces), a part run in the background (`&`), a variable set before
|
|
11
|
+
* the program (`FOO=1 node`), a comment, or an empty part. Its ask is answered each time.
|
|
12
|
+
*
|
|
13
|
+
* Chips still never sees the tool call itself; it reads the words the harness sent in its ask.
|
|
14
|
+
*/
|
|
15
|
+
/** Past this, a command is not read: a standing yes is for the commands a person reads. */
|
|
16
|
+
const LONGEST = 10_000;
|
|
17
|
+
/** What a command is, from an ask's input: its string or its words, or nothing. */
|
|
18
|
+
export function askedCommand(input) {
|
|
19
|
+
if (typeof input !== "object" || input === null)
|
|
20
|
+
return undefined;
|
|
21
|
+
const command = input["command"];
|
|
22
|
+
if (typeof command === "string")
|
|
23
|
+
return command.trim() === "" ? undefined : command;
|
|
24
|
+
if (Array.isArray(command) &&
|
|
25
|
+
command.length > 0 &&
|
|
26
|
+
command.every((word) => typeof word === "string" && word !== "")) {
|
|
27
|
+
return command;
|
|
28
|
+
}
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
/** The command's parts, each as its words; nothing for a command this reader can't follow. */
|
|
32
|
+
export function commandParts(command) {
|
|
33
|
+
if (typeof command !== "string")
|
|
34
|
+
return command.length === 0 ? undefined : [[...command]];
|
|
35
|
+
if (command.length > LONGEST)
|
|
36
|
+
return undefined;
|
|
37
|
+
const reader = new Reader(command);
|
|
38
|
+
const parts = reader.read();
|
|
39
|
+
// A variable set before the program changes what runs, and a shell's own word (`if`, `!`)
|
|
40
|
+
// runs the words after it, which the parts would not show as a program.
|
|
41
|
+
const unread = parts?.some((part) => /^[A-Za-z_][A-Za-z0-9_]*=/.test(part[0] ?? "") || KEYWORDS.has(part[0] ?? ""));
|
|
42
|
+
return unread === false ? parts : undefined;
|
|
43
|
+
}
|
|
44
|
+
/** One pass over a command's characters: `false` from a step means it can't be read. */
|
|
45
|
+
class Reader {
|
|
46
|
+
command;
|
|
47
|
+
parts = [];
|
|
48
|
+
words = [];
|
|
49
|
+
word;
|
|
50
|
+
quote;
|
|
51
|
+
at = 0;
|
|
52
|
+
constructor(command) {
|
|
53
|
+
this.command = command;
|
|
54
|
+
}
|
|
55
|
+
read() {
|
|
56
|
+
for (; this.at < this.command.length; this.at += 1) {
|
|
57
|
+
const char = this.command[this.at];
|
|
58
|
+
const fine = this.quote === "'"
|
|
59
|
+
? this.single(char)
|
|
60
|
+
: this.quote === '"'
|
|
61
|
+
? this.double(char)
|
|
62
|
+
: this.bare(char);
|
|
63
|
+
if (!fine)
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
if (this.quote !== undefined)
|
|
67
|
+
return undefined;
|
|
68
|
+
this.endWord();
|
|
69
|
+
if (this.words.length > 0)
|
|
70
|
+
this.parts.push(this.words);
|
|
71
|
+
// A chain left open (`ls &&`, `ls |`) is not a command; a last `;` or new line is.
|
|
72
|
+
else if (this.parts.length === 0 || !/[;\n]\s*$/.test(this.command))
|
|
73
|
+
return undefined;
|
|
74
|
+
return this.parts;
|
|
75
|
+
}
|
|
76
|
+
/** Inside single quotes everything is itself, up to the closing quote. */
|
|
77
|
+
single(char) {
|
|
78
|
+
if (char === "'")
|
|
79
|
+
this.quote = undefined;
|
|
80
|
+
else
|
|
81
|
+
this.word += char;
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
/** Inside double quotes a shell still runs `$` and backticks, so those can't be read. */
|
|
85
|
+
double(char) {
|
|
86
|
+
if (char === '"')
|
|
87
|
+
this.quote = undefined;
|
|
88
|
+
else if (char === "$" || char === "`")
|
|
89
|
+
return false;
|
|
90
|
+
else if (char === "\\" && '"\\$`'.includes(this.command[this.at + 1] ?? "")) {
|
|
91
|
+
this.at += 1;
|
|
92
|
+
this.word += this.command[this.at];
|
|
93
|
+
}
|
|
94
|
+
else
|
|
95
|
+
this.word += char;
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
bare(char) {
|
|
99
|
+
if (char === "'" || char === '"') {
|
|
100
|
+
this.quote = char;
|
|
101
|
+
this.word ??= "";
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
if (char === "\\")
|
|
105
|
+
return this.escaped();
|
|
106
|
+
if (char === " " || char === "\t") {
|
|
107
|
+
this.endWord();
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
const between = this.between(char);
|
|
111
|
+
if (between !== undefined)
|
|
112
|
+
return between;
|
|
113
|
+
if ("<>()&$`{}".includes(char) || (char === "#" && this.word === undefined))
|
|
114
|
+
return false;
|
|
115
|
+
this.word = (this.word ?? "") + char;
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
/** Where one part ends and the next starts, if it does here: `&&`, `||`, `;`, `|`, a new line. */
|
|
119
|
+
between(char) {
|
|
120
|
+
const pair = this.command.slice(this.at, this.at + 2);
|
|
121
|
+
if (pair === "&&" || pair === "||") {
|
|
122
|
+
this.at += 1;
|
|
123
|
+
return this.endPart();
|
|
124
|
+
}
|
|
125
|
+
return char === ";" || char === "|" || char === "\n" ? this.endPart() : undefined;
|
|
126
|
+
}
|
|
127
|
+
/** A backslash outside quotes makes the next character itself; at the end it continues a line. */
|
|
128
|
+
escaped() {
|
|
129
|
+
const next = this.command[this.at + 1];
|
|
130
|
+
if (next === undefined || next === "\n")
|
|
131
|
+
return false;
|
|
132
|
+
this.word = (this.word ?? "") + next;
|
|
133
|
+
this.at += 1;
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
endWord() {
|
|
137
|
+
if (this.word !== undefined)
|
|
138
|
+
this.words.push(this.word);
|
|
139
|
+
this.word = undefined;
|
|
140
|
+
}
|
|
141
|
+
/** A part ends at `&&`, `||`, `;`, `|` or a new line; an empty one can't be read. */
|
|
142
|
+
endPart() {
|
|
143
|
+
this.endWord();
|
|
144
|
+
if (this.words.length === 0)
|
|
145
|
+
return false;
|
|
146
|
+
this.parts.push(this.words);
|
|
147
|
+
this.words = [];
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/** The shell's own words, which run what follows them rather than being a program. */
|
|
152
|
+
const KEYWORDS = new Set([
|
|
153
|
+
"!",
|
|
154
|
+
"if",
|
|
155
|
+
"then",
|
|
156
|
+
"else",
|
|
157
|
+
"elif",
|
|
158
|
+
"fi",
|
|
159
|
+
"for",
|
|
160
|
+
"while",
|
|
161
|
+
"until",
|
|
162
|
+
"do",
|
|
163
|
+
"done",
|
|
164
|
+
"case",
|
|
165
|
+
"esac",
|
|
166
|
+
"select",
|
|
167
|
+
"function",
|
|
168
|
+
"coproc",
|
|
169
|
+
"[[",
|
|
170
|
+
"]]",
|
|
171
|
+
]);
|
|
172
|
+
/**
|
|
173
|
+
* The commands a standing yes is never given for (ADR 0239): they can't be undone, leave the
|
|
174
|
+
* machine, act as somebody else, or run whatever code or command they are given. A part matches
|
|
175
|
+
* an entry of one word when its program is that word, and an entry of two when its program is the
|
|
176
|
+
* first and the second is among its words, wherever it stands (`git -C dir push`).
|
|
177
|
+
*/
|
|
178
|
+
export const NEVER_STANDING = [
|
|
179
|
+
["rm"],
|
|
180
|
+
["rmdir"],
|
|
181
|
+
["sudo"],
|
|
182
|
+
["su"],
|
|
183
|
+
["doas"],
|
|
184
|
+
["chmod"],
|
|
185
|
+
["chown"],
|
|
186
|
+
["dd"],
|
|
187
|
+
["mkfs"],
|
|
188
|
+
["kill"],
|
|
189
|
+
["killall"],
|
|
190
|
+
["pkill"],
|
|
191
|
+
["shutdown"],
|
|
192
|
+
["reboot"],
|
|
193
|
+
["curl"],
|
|
194
|
+
["wget"],
|
|
195
|
+
["ssh"],
|
|
196
|
+
["scp"],
|
|
197
|
+
["rsync"],
|
|
198
|
+
["git", "push"],
|
|
199
|
+
["git", "reset"],
|
|
200
|
+
["git", "clean"],
|
|
201
|
+
["find", "-exec"],
|
|
202
|
+
["find", "-execdir"],
|
|
203
|
+
["find", "-ok"],
|
|
204
|
+
["find", "-delete"],
|
|
205
|
+
["sh", "-c"],
|
|
206
|
+
["bash", "-c"],
|
|
207
|
+
["zsh", "-c"],
|
|
208
|
+
["eval"],
|
|
209
|
+
["exec"],
|
|
210
|
+
["xargs"],
|
|
211
|
+
["env"],
|
|
212
|
+
["command"],
|
|
213
|
+
["builtin"],
|
|
214
|
+
["nohup"],
|
|
215
|
+
["time"],
|
|
216
|
+
["timeout"],
|
|
217
|
+
["nice"],
|
|
218
|
+
["watch"],
|
|
219
|
+
["node", "-e"],
|
|
220
|
+
["node", "--eval"],
|
|
221
|
+
["python", "-c"],
|
|
222
|
+
["python3", "-c"],
|
|
223
|
+
["perl", "-e"],
|
|
224
|
+
["ruby", "-e"],
|
|
225
|
+
];
|
|
226
|
+
/** A program's own name, from a path to it: `/bin/rm` is `rm`. */
|
|
227
|
+
function programOf(word) {
|
|
228
|
+
return word.slice(word.lastIndexOf("/") + 1);
|
|
229
|
+
}
|
|
230
|
+
/** The listed command a part uses, in words (`rm`, `git push`); nothing for one not listed. */
|
|
231
|
+
export function neverStanding(parts) {
|
|
232
|
+
for (const part of parts) {
|
|
233
|
+
const program = programOf(part[0] ?? "");
|
|
234
|
+
const rest = part.slice(1);
|
|
235
|
+
const listed = NEVER_STANDING.find(([first, second]) => first === program && (second === undefined || rest.includes(second)));
|
|
236
|
+
if (listed !== undefined)
|
|
237
|
+
return listed.join(" ");
|
|
238
|
+
}
|
|
239
|
+
return undefined;
|
|
240
|
+
}
|
|
241
|
+
/** How a part starts, as a standing yes remembers it: its first two words, or its one. */
|
|
242
|
+
export function startOf(part) {
|
|
243
|
+
return part.slice(0, 2);
|
|
244
|
+
}
|
|
245
|
+
/** Each part's start, once each, in the command's order. */
|
|
246
|
+
export function commandStarts(parts) {
|
|
247
|
+
const starts = [];
|
|
248
|
+
for (const part of parts) {
|
|
249
|
+
const start = startOf(part);
|
|
250
|
+
if (!starts.some((kept) => sameWords(kept, start)))
|
|
251
|
+
starts.push(start);
|
|
252
|
+
}
|
|
253
|
+
return starts;
|
|
254
|
+
}
|
|
255
|
+
/** Whether the part begins with these words, each exactly. */
|
|
256
|
+
export function startsWith(part, start) {
|
|
257
|
+
return start.length > 0 && start.length <= part.length && start.every((w, i) => part[i] === w);
|
|
258
|
+
}
|
|
259
|
+
function sameWords(one, other) {
|
|
260
|
+
return one.length === other.length && one.every((w, i) => other[i] === w);
|
|
261
|
+
}
|
|
262
|
+
export function standingOffer(input) {
|
|
263
|
+
const command = askedCommand(input);
|
|
264
|
+
if (command === undefined)
|
|
265
|
+
return undefined;
|
|
266
|
+
const parts = commandParts(command);
|
|
267
|
+
if (parts === undefined)
|
|
268
|
+
return { kind: "unreadable" };
|
|
269
|
+
const never = neverStanding(parts);
|
|
270
|
+
if (never !== undefined)
|
|
271
|
+
return { kind: "never", command: never };
|
|
272
|
+
return { kind: "starts", starts: commandStarts(parts) };
|
|
273
|
+
}
|
|
274
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,2FAA2F;AAC3F,MAAM,OAAO,GAAG,MAAM,CAAC;AAEvB,mFAAmF;AACnF,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAClE,MAAM,OAAO,GAAI,K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AAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAC5E,CAAC;AAWD,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,MAAM,OAAO,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACpC,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC5C,MAAM,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;IACvD,MAAM,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IACnC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAClE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The server, as the people paired to it see it, and the gallery a person picks an agent from
|
|
3
|
+
* (ADRs 0170, 0171).
|
|
4
|
+
*
|
|
5
|
+
* - **`GET /v1/server`** says which machine Chips runs on ("Arjun's Mac mini"), its version, and
|
|
6
|
+
* how far it reaches: the welcome and the setup card say it.
|
|
7
|
+
* - **`GET /v1/connectors`** hands out the gallery's cards. They are docs content: each connector
|
|
8
|
+
* lives with its harness (ADR 0051), and the docs say what each is and how it connects. The
|
|
9
|
+
* server reads the docs' `connectors.json` from wherever it was told (`CHIPS_CONNECTORS`) and
|
|
10
|
+
* passes it on. Chips names no harness itself, so with nothing to read the gallery is the two
|
|
11
|
+
* ways in the apps carry: your own harness, and anything with HTTP.
|
|
12
|
+
*
|
|
13
|
+
* A card's `command` and `sentence` carry `{link}` where a join link (ADR 0122) goes:
|
|
14
|
+
* `fillLink` puts it there. The sentence is what a person pastes into the chat where they already
|
|
15
|
+
* talk to their agent, so that the agent connects itself.
|
|
16
|
+
*/
|
|
17
|
+
import { z } from "zod";
|
|
18
|
+
/** What `{link}` is spelled as in a card's command and sentence. */
|
|
19
|
+
export declare const LINK_SLOT = "{link}";
|
|
20
|
+
/** A connector's line or sentence with the link in it. */
|
|
21
|
+
export declare function fillLink(template: string, link: string): string;
|
|
22
|
+
/** How a connector is brought in, which decides what its card offers. */
|
|
23
|
+
export declare const connectorKind: z.ZodEnum<{
|
|
24
|
+
"one-line": "one-line";
|
|
25
|
+
sdk: "sdk";
|
|
26
|
+
http: "http";
|
|
27
|
+
guide: "guide";
|
|
28
|
+
}>;
|
|
29
|
+
export type ConnectorKind = z.infer<typeof connectorKind>;
|
|
30
|
+
export declare const connector: z.ZodObject<{
|
|
31
|
+
id: z.ZodString;
|
|
32
|
+
name: z.ZodString;
|
|
33
|
+
line: z.ZodString;
|
|
34
|
+
needs: z.ZodOptional<z.ZodString>;
|
|
35
|
+
kind: z.ZodEnum<{
|
|
36
|
+
"one-line": "one-line";
|
|
37
|
+
sdk: "sdk";
|
|
38
|
+
http: "http";
|
|
39
|
+
guide: "guide";
|
|
40
|
+
}>;
|
|
41
|
+
command: z.ZodOptional<z.ZodString>;
|
|
42
|
+
sentence: z.ZodOptional<z.ZodString>;
|
|
43
|
+
package: z.ZodOptional<z.ZodString>;
|
|
44
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
45
|
+
capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
46
|
+
docs: z.ZodOptional<z.ZodURL>;
|
|
47
|
+
published: z.ZodOptional<z.ZodBoolean>;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
export type Connector = z.infer<typeof connector>;
|
|
50
|
+
/** The most cards the gallery shows: the docs are a list, not a store. */
|
|
51
|
+
export declare const CONNECTORS_MAX = 24;
|
|
52
|
+
/**
|
|
53
|
+
* The cards in a `connectors.json`, keeping each that reads and leaving out each that doesn't: a
|
|
54
|
+
* bad entry in the docs costs that card, never the gallery. Nothing that isn't a list is nothing.
|
|
55
|
+
*/
|
|
56
|
+
export declare function readConnectors(raw: unknown): Connector[];
|
|
57
|
+
export declare const connectorsAnswer: z.ZodObject<{
|
|
58
|
+
connectors: z.ZodArray<z.ZodObject<{
|
|
59
|
+
id: z.ZodString;
|
|
60
|
+
name: z.ZodString;
|
|
61
|
+
line: z.ZodString;
|
|
62
|
+
needs: z.ZodOptional<z.ZodString>;
|
|
63
|
+
kind: z.ZodEnum<{
|
|
64
|
+
"one-line": "one-line";
|
|
65
|
+
sdk: "sdk";
|
|
66
|
+
http: "http";
|
|
67
|
+
guide: "guide";
|
|
68
|
+
}>;
|
|
69
|
+
command: z.ZodOptional<z.ZodString>;
|
|
70
|
+
sentence: z.ZodOptional<z.ZodString>;
|
|
71
|
+
package: z.ZodOptional<z.ZodString>;
|
|
72
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
73
|
+
capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
74
|
+
docs: z.ZodOptional<z.ZodURL>;
|
|
75
|
+
published: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
+
}, z.core.$strip>>;
|
|
77
|
+
read_at: z.ZodOptional<z.ZodString>;
|
|
78
|
+
}, z.core.$strip>;
|
|
79
|
+
export type ConnectorsAnswer = z.infer<typeof connectorsAnswer>;
|
|
80
|
+
export declare const serverFacts: z.ZodObject<{
|
|
81
|
+
machine: z.ZodString;
|
|
82
|
+
version: z.ZodString;
|
|
83
|
+
public_url: z.ZodURL;
|
|
84
|
+
relay: z.ZodObject<{
|
|
85
|
+
url: z.ZodNullable<z.ZodString>;
|
|
86
|
+
status: z.ZodString;
|
|
87
|
+
}, z.core.$strip>;
|
|
88
|
+
}, z.core.$strip>;
|
|
89
|
+
export type ServerFacts = z.infer<typeof serverFacts>;
|
|
90
|
+
//# sourceMappingURL=connectors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectors.d.ts","sourceRoot":"","sources":["../../src/connectors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,oEAAoE;AACpE,eAAO,MAAM,SAAS,WAAW,CAAC;AAElC,0DAA0D;AAC1D,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/D;AAID,yEAAyE;AACzE,eAAO,MAAM,aAAa;;;;;EAIvB,CAAC;AACJ,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;iBAkDwD,CAAC;AAC/E,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD,0EAA0E;AAC1E,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,SAAS,EAAE,CAkBxD;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;iBAQ2C,CAAC;AACzE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE,eAAO,MAAM,WAAW;;;;;;;;iBAUkE,CAAC;AAC3F,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The server, as the people paired to it see it, and the gallery a person picks an agent from
|
|
3
|
+
* (ADRs 0170, 0171).
|
|
4
|
+
*
|
|
5
|
+
* - **`GET /v1/server`** says which machine Chips runs on ("Arjun's Mac mini"), its version, and
|
|
6
|
+
* how far it reaches: the welcome and the setup card say it.
|
|
7
|
+
* - **`GET /v1/connectors`** hands out the gallery's cards. They are docs content: each connector
|
|
8
|
+
* lives with its harness (ADR 0051), and the docs say what each is and how it connects. The
|
|
9
|
+
* server reads the docs' `connectors.json` from wherever it was told (`CHIPS_CONNECTORS`) and
|
|
10
|
+
* passes it on. Chips names no harness itself, so with nothing to read the gallery is the two
|
|
11
|
+
* ways in the apps carry: your own harness, and anything with HTTP.
|
|
12
|
+
*
|
|
13
|
+
* A card's `command` and `sentence` carry `{link}` where a join link (ADR 0122) goes:
|
|
14
|
+
* `fillLink` puts it there. The sentence is what a person pastes into the chat where they already
|
|
15
|
+
* talk to their agent, so that the agent connects itself.
|
|
16
|
+
*/
|
|
17
|
+
import { z } from "zod";
|
|
18
|
+
/** What `{link}` is spelled as in a card's command and sentence. */
|
|
19
|
+
export const LINK_SLOT = "{link}";
|
|
20
|
+
/** A connector's line or sentence with the link in it. */
|
|
21
|
+
export function fillLink(template, link) {
|
|
22
|
+
return template.split(LINK_SLOT).join(link);
|
|
23
|
+
}
|
|
24
|
+
const words = (most) => z.string().trim().min(1).max(most);
|
|
25
|
+
/** How a connector is brought in, which decides what its card offers. */
|
|
26
|
+
export const connectorKind = z
|
|
27
|
+
.enum(["one-line", "sdk", "http", "guide"])
|
|
28
|
+
.describe("`one-line`: a command to run where the harness runs; `sdk`: code on @chipschat/harness; `http`: a key and curl lines; `guide`: a page to follow.");
|
|
29
|
+
export const connector = z
|
|
30
|
+
.object({
|
|
31
|
+
id: z
|
|
32
|
+
.string()
|
|
33
|
+
.regex(/^[a-z0-9][a-z0-9-]{0,40}$/)
|
|
34
|
+
.describe("The docs' name for it, lower case."),
|
|
35
|
+
name: words(60).describe("What a person calls it."),
|
|
36
|
+
line: words(120).describe("One line under the name: where it runs, what it needs."),
|
|
37
|
+
needs: words(120)
|
|
38
|
+
.optional()
|
|
39
|
+
.describe('What has to be on the computer first, said after "You need": its harness installed and running as its bridge needs. Chips for Mac says it under Connect.'),
|
|
40
|
+
kind: connectorKind,
|
|
41
|
+
command: words(400)
|
|
42
|
+
.optional()
|
|
43
|
+
.describe("What to run where the harness runs, with `{link}` where the link goes."),
|
|
44
|
+
sentence: words(600)
|
|
45
|
+
.optional()
|
|
46
|
+
.describe("What to say to the agent so it connects itself, with `{link}` in it."),
|
|
47
|
+
package: z
|
|
48
|
+
.string()
|
|
49
|
+
.regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*@\d{1,4}$/)
|
|
50
|
+
.optional()
|
|
51
|
+
.describe("The npm package its bridge is published as and the major that speaks this server's protocol, `@chipschat/hermes@1`: `chips connect <id>` fetches the newest release of that major (ADR 0218)."),
|
|
52
|
+
args: z
|
|
53
|
+
.array(z.string().regex(/^[^-\s][^\s]{0,199}$/))
|
|
54
|
+
.max(4)
|
|
55
|
+
.optional()
|
|
56
|
+
.describe("What `chips connect <id>` passes its bridge before the link is used, a config's path for one: `~/.chips-acp/codex.json`."),
|
|
57
|
+
capabilities: z
|
|
58
|
+
.array(z.string().regex(/^[a-z][a-z_]{0,39}$/))
|
|
59
|
+
.max(16)
|
|
60
|
+
.optional()
|
|
61
|
+
.describe("What its connector needs to do its job (ADR 0046): a link made from the card starts with these on."),
|
|
62
|
+
docs: z
|
|
63
|
+
.url({ protocol: /^https?$/ })
|
|
64
|
+
.optional()
|
|
65
|
+
.describe("Its page in the docs."),
|
|
66
|
+
published: z
|
|
67
|
+
.boolean()
|
|
68
|
+
.optional()
|
|
69
|
+
.describe("False while its command can't be run by somebody outside yet."),
|
|
70
|
+
})
|
|
71
|
+
.describe("A card in the gallery a person brings an agent from (ADR 0171).");
|
|
72
|
+
/** The most cards the gallery shows: the docs are a list, not a store. */
|
|
73
|
+
export const CONNECTORS_MAX = 24;
|
|
74
|
+
/**
|
|
75
|
+
* The cards in a `connectors.json`, keeping each that reads and leaving out each that doesn't: a
|
|
76
|
+
* bad entry in the docs costs that card, never the gallery. Nothing that isn't a list is nothing.
|
|
77
|
+
*/
|
|
78
|
+
export function readConnectors(raw) {
|
|
79
|
+
const list = Array.isArray(raw)
|
|
80
|
+
? raw
|
|
81
|
+
: raw !== null &&
|
|
82
|
+
typeof raw === "object" &&
|
|
83
|
+
Array.isArray(raw.connectors)
|
|
84
|
+
? raw.connectors
|
|
85
|
+
: [];
|
|
86
|
+
const kept = [];
|
|
87
|
+
const seen = new Set();
|
|
88
|
+
for (const each of list) {
|
|
89
|
+
const read = connector.safeParse(each);
|
|
90
|
+
if (!read.success || seen.has(read.data.id))
|
|
91
|
+
continue;
|
|
92
|
+
seen.add(read.data.id);
|
|
93
|
+
kept.push(read.data);
|
|
94
|
+
if (kept.length === CONNECTORS_MAX)
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
return kept;
|
|
98
|
+
}
|
|
99
|
+
export const connectorsAnswer = z
|
|
100
|
+
.object({
|
|
101
|
+
connectors: z.array(connector).max(CONNECTORS_MAX),
|
|
102
|
+
read_at: z
|
|
103
|
+
.string()
|
|
104
|
+
.optional()
|
|
105
|
+
.describe("When the server last read them, as an ISO timestamp. Absent: never."),
|
|
106
|
+
})
|
|
107
|
+
.describe("`GET /v1/connectors`: the gallery's cards, from the docs.");
|
|
108
|
+
export const serverFacts = z
|
|
109
|
+
.object({
|
|
110
|
+
machine: words(120).describe("The machine Chips runs on, as its owner named it."),
|
|
111
|
+
version: z.string(),
|
|
112
|
+
public_url: z.url({ protocol: /^https?$/ }).describe("Where another device reaches it."),
|
|
113
|
+
relay: z.object({
|
|
114
|
+
url: z.string().nullable(),
|
|
115
|
+
status: z.string().describe("`off`, `connecting`, `connected` …, as `/v1/health` says it."),
|
|
116
|
+
}),
|
|
117
|
+
})
|
|
118
|
+
.describe("`GET /v1/server`: the server, as the people paired to it see it (ADR 0170).");
|
|
119
|
+
//# sourceMappingURL=connectors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectors.js","sourceRoot":"","sources":["../../src/connectors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG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