pinecall 0.1.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 +202 -0
- package/README.md +134 -0
- package/dist/agent/accepts.d.ts +32 -0
- package/dist/agent/accepts.d.ts.map +1 -0
- package/dist/agent/accepts.js +28 -0
- package/dist/agent/accepts.js.map +1 -0
- package/dist/agent/agent.d.ts +189 -0
- package/dist/agent/agent.d.ts.map +1 -0
- package/dist/agent/agent.js +262 -0
- package/dist/agent/agent.js.map +1 -0
- package/dist/agent/authors.d.ts +12 -0
- package/dist/agent/authors.d.ts.map +1 -0
- package/dist/agent/authors.js +28 -0
- package/dist/agent/authors.js.map +1 -0
- package/dist/agent/decorators.d.ts +22 -0
- package/dist/agent/decorators.d.ts.map +1 -0
- package/dist/agent/decorators.js +49 -0
- package/dist/agent/decorators.js.map +1 -0
- package/dist/agent/docstrings.d.ts +43 -0
- package/dist/agent/docstrings.d.ts.map +1 -0
- package/dist/agent/docstrings.js +311 -0
- package/dist/agent/docstrings.js.map +1 -0
- package/dist/agent/lifecycle.d.ts +29 -0
- package/dist/agent/lifecycle.d.ts.map +1 -0
- package/dist/agent/lifecycle.js +11 -0
- package/dist/agent/lifecycle.js.map +1 -0
- package/dist/agent/stages.d.ts +28 -0
- package/dist/agent/stages.d.ts.map +1 -0
- package/dist/agent/stages.js +32 -0
- package/dist/agent/stages.js.map +1 -0
- package/dist/agent/state.d.ts +43 -0
- package/dist/agent/state.d.ts.map +1 -0
- package/dist/agent/state.js +104 -0
- package/dist/agent/state.js.map +1 -0
- package/dist/agent/tools.d.ts +66 -0
- package/dist/agent/tools.d.ts.map +1 -0
- package/dist/agent/tools.js +148 -0
- package/dist/agent/tools.js.map +1 -0
- package/dist/agent/visibility.d.ts +40 -0
- package/dist/agent/visibility.d.ts.map +1 -0
- package/dist/agent/visibility.js +89 -0
- package/dist/agent/visibility.js.map +1 -0
- package/dist/call/call.d.ts +55 -0
- package/dist/call/call.d.ts.map +1 -0
- package/dist/call/call.js +108 -0
- package/dist/call/call.js.map +1 -0
- package/dist/call/history.d.ts +34 -0
- package/dist/call/history.d.ts.map +1 -0
- package/dist/call/history.js +38 -0
- package/dist/call/history.js.map +1 -0
- package/dist/call/room.d.ts +58 -0
- package/dist/call/room.d.ts.map +1 -0
- package/dist/call/room.js +68 -0
- package/dist/call/room.js.map +1 -0
- package/dist/cli/browser.d.ts +8 -0
- package/dist/cli/browser.d.ts.map +1 -0
- package/dist/cli/browser.js +27 -0
- package/dist/cli/browser.js.map +1 -0
- package/dist/cli/callbacks.d.ts +26 -0
- package/dist/cli/callbacks.d.ts.map +1 -0
- package/dist/cli/callbacks.js +68 -0
- package/dist/cli/callbacks.js.map +1 -0
- package/dist/cli/chat.d.ts +21 -0
- package/dist/cli/chat.d.ts.map +1 -0
- package/dist/cli/chat.js +214 -0
- package/dist/cli/chat.js.map +1 -0
- package/dist/cli/config.d.ts +16 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/config.js +94 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/connected.d.ts +30 -0
- package/dist/cli/connected.d.ts.map +1 -0
- package/dist/cli/connected.js +32 -0
- package/dist/cli/connected.js.map +1 -0
- package/dist/cli/credentials.d.ts +41 -0
- package/dist/cli/credentials.d.ts.map +1 -0
- package/dist/cli/credentials.js +98 -0
- package/dist/cli/credentials.js.map +1 -0
- package/dist/cli/ear.d.ts +3 -0
- package/dist/cli/ear.d.ts.map +1 -0
- package/dist/cli/ear.js +59 -0
- package/dist/cli/ear.js.map +1 -0
- package/dist/cli/env.d.ts +40 -0
- package/dist/cli/env.d.ts.map +1 -0
- package/dist/cli/env.js +45 -0
- package/dist/cli/env.js.map +1 -0
- package/dist/cli/eval.d.ts +37 -0
- package/dist/cli/eval.d.ts.map +1 -0
- package/dist/cli/eval.js +83 -0
- package/dist/cli/eval.js.map +1 -0
- package/dist/cli/groups.d.ts +17 -0
- package/dist/cli/groups.d.ts.map +1 -0
- package/dist/cli/groups.js +38 -0
- package/dist/cli/groups.js.map +1 -0
- package/dist/cli/index.d.ts +16 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +169 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/keys.d.ts +28 -0
- package/dist/cli/keys.d.ts.map +1 -0
- package/dist/cli/keys.js +137 -0
- package/dist/cli/keys.js.map +1 -0
- package/dist/cli/knowledge.d.ts +35 -0
- package/dist/cli/knowledge.d.ts.map +1 -0
- package/dist/cli/knowledge.js +174 -0
- package/dist/cli/knowledge.js.map +1 -0
- package/dist/cli/line.d.ts +33 -0
- package/dist/cli/line.d.ts.map +1 -0
- package/dist/cli/line.js +134 -0
- package/dist/cli/line.js.map +1 -0
- package/dist/cli/listening.d.ts +38 -0
- package/dist/cli/listening.d.ts.map +1 -0
- package/dist/cli/listening.js +124 -0
- package/dist/cli/listening.js.map +1 -0
- package/dist/cli/load.d.ts +38 -0
- package/dist/cli/load.d.ts.map +1 -0
- package/dist/cli/load.js +99 -0
- package/dist/cli/load.js.map +1 -0
- package/dist/cli/login.d.ts +30 -0
- package/dist/cli/login.d.ts.map +1 -0
- package/dist/cli/login.js +158 -0
- package/dist/cli/login.js.map +1 -0
- package/dist/cli/machine.d.ts +8 -0
- package/dist/cli/machine.d.ts.map +1 -0
- package/dist/cli/machine.js +41 -0
- package/dist/cli/machine.js.map +1 -0
- package/dist/cli/memory.d.ts +26 -0
- package/dist/cli/memory.d.ts.map +1 -0
- package/dist/cli/memory.js +148 -0
- package/dist/cli/memory.js.map +1 -0
- package/dist/cli/numbers.d.ts +25 -0
- package/dist/cli/numbers.d.ts.map +1 -0
- package/dist/cli/numbers.js +132 -0
- package/dist/cli/numbers.js.map +1 -0
- package/dist/cli/personas.d.ts +5 -0
- package/dist/cli/personas.d.ts.map +1 -0
- package/dist/cli/personas.js +94 -0
- package/dist/cli/personas.js.map +1 -0
- package/dist/cli/pipeline.d.ts +52 -0
- package/dist/cli/pipeline.d.ts.map +1 -0
- package/dist/cli/pipeline.js +184 -0
- package/dist/cli/pipeline.js.map +1 -0
- package/dist/cli/profiles.d.ts +70 -0
- package/dist/cli/profiles.d.ts.map +1 -0
- package/dist/cli/profiles.js +210 -0
- package/dist/cli/profiles.js.map +1 -0
- package/dist/cli/prompt.d.ts +20 -0
- package/dist/cli/prompt.d.ts.map +1 -0
- package/dist/cli/prompt.js +58 -0
- package/dist/cli/prompt.js.map +1 -0
- package/dist/cli/providers.d.ts +14 -0
- package/dist/cli/providers.d.ts.map +1 -0
- package/dist/cli/providers.js +116 -0
- package/dist/cli/providers.js.map +1 -0
- package/dist/cli/remember.d.ts +29 -0
- package/dist/cli/remember.d.ts.map +1 -0
- package/dist/cli/remember.js +112 -0
- package/dist/cli/remember.js.map +1 -0
- package/dist/cli/run.d.ts +20 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +347 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/runs/candidate.d.ts +51 -0
- package/dist/cli/runs/candidate.d.ts.map +1 -0
- package/dist/cli/runs/candidate.js +127 -0
- package/dist/cli/runs/candidate.js.map +1 -0
- package/dist/cli/runs/drift.d.ts +75 -0
- package/dist/cli/runs/drift.d.ts.map +1 -0
- package/dist/cli/runs/drift.js +151 -0
- package/dist/cli/runs/drift.js.map +1 -0
- package/dist/cli/runs/index.d.ts +5 -0
- package/dist/cli/runs/index.d.ts.map +1 -0
- package/dist/cli/runs/index.js +99 -0
- package/dist/cli/runs/index.js.map +1 -0
- package/dist/cli/runs/suites.d.ts +16 -0
- package/dist/cli/runs/suites.d.ts.map +1 -0
- package/dist/cli/runs/suites.js +63 -0
- package/dist/cli/runs/suites.js.map +1 -0
- package/dist/cli/secret.d.ts +18 -0
- package/dist/cli/secret.d.ts.map +1 -0
- package/dist/cli/secret.js +41 -0
- package/dist/cli/secret.js.map +1 -0
- package/dist/cli/sessions.d.ts +21 -0
- package/dist/cli/sessions.d.ts.map +1 -0
- package/dist/cli/sessions.js +174 -0
- package/dist/cli/sessions.js.map +1 -0
- package/dist/cli/signup.d.ts +25 -0
- package/dist/cli/signup.d.ts.map +1 -0
- package/dist/cli/signup.js +122 -0
- package/dist/cli/signup.js.map +1 -0
- package/dist/cli/simulate.d.ts +45 -0
- package/dist/cli/simulate.d.ts.map +1 -0
- package/dist/cli/simulate.js +320 -0
- package/dist/cli/simulate.js.map +1 -0
- package/dist/cli/supervise.d.ts +18 -0
- package/dist/cli/supervise.d.ts.map +1 -0
- package/dist/cli/supervise.js +134 -0
- package/dist/cli/supervise.js.map +1 -0
- package/dist/cli/test.d.ts +12 -0
- package/dist/cli/test.d.ts.map +1 -0
- package/dist/cli/test.js +128 -0
- package/dist/cli/test.js.map +1 -0
- package/dist/cli/testing/caller.d.ts +28 -0
- package/dist/cli/testing/caller.d.ts.map +1 -0
- package/dist/cli/testing/caller.js +30 -0
- package/dist/cli/testing/caller.js.map +1 -0
- package/dist/cli/testing/gateway.d.ts +172 -0
- package/dist/cli/testing/gateway.d.ts.map +1 -0
- package/dist/cli/testing/gateway.js +96 -0
- package/dist/cli/testing/gateway.js.map +1 -0
- package/dist/cli/testing/goldens.d.ts +61 -0
- package/dist/cli/testing/goldens.d.ts.map +1 -0
- package/dist/cli/testing/goldens.js +54 -0
- package/dist/cli/testing/goldens.js.map +1 -0
- package/dist/cli/testing/latency.d.ts +15 -0
- package/dist/cli/testing/latency.d.ts.map +1 -0
- package/dist/cli/testing/latency.js +44 -0
- package/dist/cli/testing/latency.js.map +1 -0
- package/dist/cli/testing/matrix.d.ts +12 -0
- package/dist/cli/testing/matrix.d.ts.map +1 -0
- package/dist/cli/testing/matrix.js +103 -0
- package/dist/cli/testing/matrix.js.map +1 -0
- package/dist/cli/testing/progress.d.ts +26 -0
- package/dist/cli/testing/progress.d.ts.map +1 -0
- package/dist/cli/testing/progress.js +185 -0
- package/dist/cli/testing/progress.js.map +1 -0
- package/dist/cli/testing/reproduction.d.ts +19 -0
- package/dist/cli/testing/reproduction.d.ts.map +1 -0
- package/dist/cli/testing/reproduction.js +65 -0
- package/dist/cli/testing/reproduction.js.map +1 -0
- package/dist/cli/testing/score.d.ts +11 -0
- package/dist/cli/testing/score.d.ts.map +1 -0
- package/dist/cli/testing/score.js +54 -0
- package/dist/cli/testing/score.js.map +1 -0
- package/dist/cli/testing/seeding.d.ts +32 -0
- package/dist/cli/testing/seeding.d.ts.map +1 -0
- package/dist/cli/testing/seeding.js +44 -0
- package/dist/cli/testing/seeding.js.map +1 -0
- package/dist/cli/testing/suite.d.ts +40 -0
- package/dist/cli/testing/suite.d.ts.map +1 -0
- package/dist/cli/testing/suite.js +103 -0
- package/dist/cli/testing/suite.js.map +1 -0
- package/dist/cli/testing/voice.d.ts +37 -0
- package/dist/cli/testing/voice.d.ts.map +1 -0
- package/dist/cli/testing/voice.js +53 -0
- package/dist/cli/testing/voice.js.map +1 -0
- package/dist/cli/ui/admin/assets/index-C3WMXdfL.css +1 -0
- package/dist/cli/ui/admin/assets/index-DR1mxoAh.js +58 -0
- package/dist/cli/ui/admin/index.html +20 -0
- package/dist/cli/ui/asked.d.ts +16 -0
- package/dist/cli/ui/asked.d.ts.map +1 -0
- package/dist/cli/ui/asked.js +53 -0
- package/dist/cli/ui/asked.js.map +1 -0
- package/dist/cli/ui/browser.d.ts +10 -0
- package/dist/cli/ui/browser.d.ts.map +1 -0
- package/dist/cli/ui/browser.js +30 -0
- package/dist/cli/ui/browser.js.map +1 -0
- package/dist/cli/ui/chatting.d.ts +62 -0
- package/dist/cli/ui/chatting.d.ts.map +1 -0
- package/dist/cli/ui/chatting.js +171 -0
- package/dist/cli/ui/chatting.js.map +1 -0
- package/dist/cli/ui/console/assets/index-DCTnou52.css +1 -0
- package/dist/cli/ui/console/assets/index-dOcE4usU.js +99 -0
- package/dist/cli/ui/console/index.html +20 -0
- package/dist/cli/ui/console/logo-mark.png +0 -0
- package/dist/cli/ui/doors.d.ts +37 -0
- package/dist/cli/ui/doors.d.ts.map +1 -0
- package/dist/cli/ui/doors.js +70 -0
- package/dist/cli/ui/doors.js.map +1 -0
- package/dist/cli/ui/drifting.d.ts +23 -0
- package/dist/cli/ui/drifting.d.ts.map +1 -0
- package/dist/cli/ui/drifting.js +33 -0
- package/dist/cli/ui/drifting.js.map +1 -0
- package/dist/cli/ui/index.d.ts +15 -0
- package/dist/cli/ui/index.d.ts.map +1 -0
- package/dist/cli/ui/index.js +117 -0
- package/dist/cli/ui/index.js.map +1 -0
- package/dist/cli/ui/knowing.d.ts +36 -0
- package/dist/cli/ui/knowing.d.ts.map +1 -0
- package/dist/cli/ui/knowing.js +86 -0
- package/dist/cli/ui/knowing.js.map +1 -0
- package/dist/cli/ui/promoting.d.ts +26 -0
- package/dist/cli/ui/promoting.d.ts.map +1 -0
- package/dist/cli/ui/promoting.js +44 -0
- package/dist/cli/ui/promoting.js.map +1 -0
- package/dist/cli/ui/refusal.d.ts +18 -0
- package/dist/cli/ui/refusal.d.ts.map +1 -0
- package/dist/cli/ui/refusal.js +26 -0
- package/dist/cli/ui/refusal.js.map +1 -0
- package/dist/cli/ui/refused.d.ts +8 -0
- package/dist/cli/ui/refused.d.ts.map +1 -0
- package/dist/cli/ui/refused.js +11 -0
- package/dist/cli/ui/refused.js.map +1 -0
- package/dist/cli/ui/remembering.d.ts +38 -0
- package/dist/cli/ui/remembering.d.ts.map +1 -0
- package/dist/cli/ui/remembering.js +87 -0
- package/dist/cli/ui/remembering.js.map +1 -0
- package/dist/cli/ui/reproducing.d.ts +23 -0
- package/dist/cli/ui/reproducing.d.ts.map +1 -0
- package/dist/cli/ui/reproducing.js +52 -0
- package/dist/cli/ui/reproducing.js.map +1 -0
- package/dist/cli/ui/server.d.ts +22 -0
- package/dist/cli/ui/server.d.ts.map +1 -0
- package/dist/cli/ui/server.js +211 -0
- package/dist/cli/ui/server.js.map +1 -0
- package/dist/cli/ui/simulating.d.ts +47 -0
- package/dist/cli/ui/simulating.d.ts.map +1 -0
- package/dist/cli/ui/simulating.js +86 -0
- package/dist/cli/ui/simulating.js.map +1 -0
- package/dist/cli/ui/testing.d.ts +49 -0
- package/dist/cli/ui/testing.d.ts.map +1 -0
- package/dist/cli/ui/testing.js +104 -0
- package/dist/cli/ui/testing.js.map +1 -0
- package/dist/cli/view.d.ts +43 -0
- package/dist/cli/view.d.ts.map +1 -0
- package/dist/cli/view.js +137 -0
- package/dist/cli/view.js.map +1 -0
- package/dist/cli/whoami.d.ts +37 -0
- package/dist/cli/whoami.d.ts.map +1 -0
- package/dist/cli/whoami.js +78 -0
- package/dist/cli/whoami.js.map +1 -0
- package/dist/cli/world.d.ts +33 -0
- package/dist/cli/world.d.ts.map +1 -0
- package/dist/cli/world.js +48 -0
- package/dist/cli/world.js.map +1 -0
- package/dist/client/agent.d.ts +87 -0
- package/dist/client/agent.d.ts.map +1 -0
- package/dist/client/agent.js +209 -0
- package/dist/client/agent.js.map +1 -0
- package/dist/client/calls.d.ts +77 -0
- package/dist/client/calls.d.ts.map +1 -0
- package/dist/client/calls.js +153 -0
- package/dist/client/calls.js.map +1 -0
- package/dist/client/client.d.ts +58 -0
- package/dist/client/client.d.ts.map +1 -0
- package/dist/client/client.js +146 -0
- package/dist/client/client.js.map +1 -0
- package/dist/client/connection.d.ts +47 -0
- package/dist/client/connection.d.ts.map +1 -0
- package/dist/client/connection.js +141 -0
- package/dist/client/connection.js.map +1 -0
- package/dist/client/endpoints.d.ts +7 -0
- package/dist/client/endpoints.d.ts.map +1 -0
- package/dist/client/endpoints.js +21 -0
- package/dist/client/endpoints.js.map +1 -0
- package/dist/client/frames.d.ts +24 -0
- package/dist/client/frames.d.ts.map +1 -0
- package/dist/client/frames.js +49 -0
- package/dist/client/frames.js.map +1 -0
- package/dist/client/index.d.ts +15 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +14 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/listeners.d.ts +36 -0
- package/dist/client/listeners.d.ts.map +1 -0
- package/dist/client/listeners.js +61 -0
- package/dist/client/listeners.js.map +1 -0
- package/dist/client/observe.d.ts +44 -0
- package/dist/client/observe.d.ts.map +1 -0
- package/dist/client/observe.js +122 -0
- package/dist/client/observe.js.map +1 -0
- package/dist/client/testing/gateway.d.ts +39 -0
- package/dist/client/testing/gateway.d.ts.map +1 -0
- package/dist/client/testing/gateway.js +129 -0
- package/dist/client/testing/gateway.js.map +1 -0
- package/dist/client/testing/index.d.ts +4 -0
- package/dist/client/testing/index.d.ts.map +1 -0
- package/dist/client/testing/index.js +4 -0
- package/dist/client/testing/index.js.map +1 -0
- package/dist/client/testing/log.d.ts +26 -0
- package/dist/client/testing/log.d.ts.map +1 -0
- package/dist/client/testing/log.js +111 -0
- package/dist/client/testing/log.js.map +1 -0
- package/dist/client/testing/loopback.d.ts +3 -0
- package/dist/client/testing/loopback.d.ts.map +1 -0
- package/dist/client/testing/loopback.js +3 -0
- package/dist/client/testing/loopback.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime/channels.d.ts +16 -0
- package/dist/runtime/channels.d.ts.map +1 -0
- package/dist/runtime/channels.js +30 -0
- package/dist/runtime/channels.js.map +1 -0
- package/dist/runtime/connect.d.ts +51 -0
- package/dist/runtime/connect.d.ts.map +1 -0
- package/dist/runtime/connect.js +284 -0
- package/dist/runtime/connect.js.map +1 -0
- package/dist/runtime/dispatch.d.ts +37 -0
- package/dist/runtime/dispatch.d.ts.map +1 -0
- package/dist/runtime/dispatch.js +52 -0
- package/dist/runtime/dispatch.js.map +1 -0
- package/dist/runtime/grounding.d.ts +15 -0
- package/dist/runtime/grounding.d.ts.map +1 -0
- package/dist/runtime/grounding.js +72 -0
- package/dist/runtime/grounding.js.map +1 -0
- package/dist/runtime/recall.d.ts +10 -0
- package/dist/runtime/recall.d.ts.map +1 -0
- package/dist/runtime/recall.js +13 -0
- package/dist/runtime/recall.js.map +1 -0
- package/dist/runtime/run-tool.d.ts +26 -0
- package/dist/runtime/run-tool.d.ts.map +1 -0
- package/dist/runtime/run-tool.js +82 -0
- package/dist/runtime/run-tool.js.map +1 -0
- package/dist/views/components.d.ts +17 -0
- package/dist/views/components.d.ts.map +1 -0
- package/dist/views/components.js +33 -0
- package/dist/views/components.js.map +1 -0
- package/dist/views/jsx-dev-runtime.d.ts +3 -0
- package/dist/views/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/views/jsx-dev-runtime.js +5 -0
- package/dist/views/jsx-dev-runtime.js.map +1 -0
- package/dist/views/jsx-runtime.d.ts +49 -0
- package/dist/views/jsx-runtime.d.ts.map +1 -0
- package/dist/views/jsx-runtime.js +67 -0
- package/dist/views/jsx-runtime.js.map +1 -0
- package/dist/views/lang.d.ts +17 -0
- package/dist/views/lang.d.ts.map +1 -0
- package/dist/views/lang.js +46 -0
- package/dist/views/lang.js.map +1 -0
- package/dist/views/layout.d.ts +19 -0
- package/dist/views/layout.d.ts.map +1 -0
- package/dist/views/layout.js +62 -0
- package/dist/views/layout.js.map +1 -0
- package/dist/views/render.d.ts +19 -0
- package/dist/views/render.d.ts.map +1 -0
- package/dist/views/render.js +26 -0
- package/dist/views/render.js.map +1 -0
- package/package.json +76 -0
- package/tsconfig.tenant.json +24 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/** ~/.pinecall/config.json: the gateways this machine knows, by name, and which one is in hand. */
|
|
2
|
+
import { chmodSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { normalised, pinecallHome, readCredentials } from "./credentials.js";
|
|
5
|
+
// The directory is a person's and the file holds keys: 0700 and 0600, as the old two were.
|
|
6
|
+
const DIRECTORY_MODE = 0o700;
|
|
7
|
+
const FILE_MODE = 0o600;
|
|
8
|
+
const CONFIG = "config.json";
|
|
9
|
+
/**
|
|
10
|
+
* Every profile this machine has, and which is active.
|
|
11
|
+
*
|
|
12
|
+
* There were four files and three variables answering two questions — which gateway, and which
|
|
13
|
+
* key — with a precedence nobody was ever told. This is the one file. The one it replaces is
|
|
14
|
+
* read ONCE, here, and written into it: `~/.pinecall/credentials`, which `pinecall login` kept a
|
|
15
|
+
* row per gateway in. It is not deleted — v1's CLI still reads it on this same machine — and it is
|
|
16
|
+
* not read again once this file exists. The third source, `~/.pinecall/dev`, went with the dev key
|
|
17
|
+
* that wrote it: a local gateway runs the same Postgres and the same issued keys a box does.
|
|
18
|
+
*/
|
|
19
|
+
export function readConfig(home = pinecallHome()) {
|
|
20
|
+
return parsedConfig(home) ?? migrated(home);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* `~/.pinecall/credentials`, folded in once and written down, the first time there is no config.
|
|
24
|
+
*
|
|
25
|
+
* A one-time thing on purpose: after this, `config.json` is the file, and the old one is left on
|
|
26
|
+
* disk untouched because v1's CLI on this same machine still reads it.
|
|
27
|
+
*/
|
|
28
|
+
function migrated(home) {
|
|
29
|
+
const config = { profiles: {} };
|
|
30
|
+
for (const [url, row] of Object.entries(readCredentials(home).gateways)) {
|
|
31
|
+
config.profiles[nameFor(url, config)] = {
|
|
32
|
+
url,
|
|
33
|
+
key: row.api_key,
|
|
34
|
+
...(row.org === undefined ? {} : { org: row.org }),
|
|
35
|
+
...(row.calling === undefined ? {} : { calling: row.calling }),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const [only, ...rest] = Object.keys(config.profiles);
|
|
39
|
+
// One gateway is not a choice: a person who logged in to exactly one should never name it.
|
|
40
|
+
if (only !== undefined && rest.length === 0)
|
|
41
|
+
config.active = only;
|
|
42
|
+
if (only !== undefined)
|
|
43
|
+
writeConfig(config, home);
|
|
44
|
+
return config;
|
|
45
|
+
}
|
|
46
|
+
// What `--profile <name>` said, for this one invocation. It is read out of argv once, by the
|
|
47
|
+
// dispatcher, before any group sees its flags — twenty verbs each parsing the same flag is twenty
|
|
48
|
+
// places for it to be missing from. Set once at startup and never again: a parsed argument that
|
|
49
|
+
// happens to live in a module, not state anything changes while a verb runs.
|
|
50
|
+
let chosen;
|
|
51
|
+
/**
|
|
52
|
+
* Take `--profile <name>` out of an invocation's argv, and remember it.
|
|
53
|
+
*
|
|
54
|
+
* Returns what is left, so the group sees only its own flags. `--profile=<name>` too, because
|
|
55
|
+
* both spellings are what a person types and only one of them working is a footgun.
|
|
56
|
+
*/
|
|
57
|
+
export function withoutTheProfileFlag(argv) {
|
|
58
|
+
const rest = [];
|
|
59
|
+
for (let at = 0; at < argv.length; at += 1) {
|
|
60
|
+
const word = argv[at];
|
|
61
|
+
if (word === "--profile") {
|
|
62
|
+
chosen = argv[at + 1];
|
|
63
|
+
at += 1;
|
|
64
|
+
}
|
|
65
|
+
else if (word.startsWith("--profile=")) {
|
|
66
|
+
chosen = word.slice("--profile=".length);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
rest.push(word);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return rest;
|
|
73
|
+
}
|
|
74
|
+
/** The profile this invocation named, when it named one. */
|
|
75
|
+
export function theChosenProfile() {
|
|
76
|
+
return chosen;
|
|
77
|
+
}
|
|
78
|
+
/** The profile a verb runs on: the one named, or the active one, or nothing at all. */
|
|
79
|
+
export function profileFor(named, home = pinecallHome()) {
|
|
80
|
+
const config = readConfig(home);
|
|
81
|
+
const name = named ?? config.active;
|
|
82
|
+
return name === undefined ? undefined : config.profiles[name];
|
|
83
|
+
}
|
|
84
|
+
/** Which profile is in hand, for a line that says where a verb is about to go. */
|
|
85
|
+
export function activeName(home = pinecallHome()) {
|
|
86
|
+
return readConfig(home).active;
|
|
87
|
+
}
|
|
88
|
+
/** Keep one profile and make it the active one: what `pinecall login` does when it has a key. */
|
|
89
|
+
export function writeProfile(name, profile, home = pinecallHome()) {
|
|
90
|
+
const config = readConfig(home);
|
|
91
|
+
config.profiles[name] = profile;
|
|
92
|
+
config.active = name;
|
|
93
|
+
writeConfig(config, home);
|
|
94
|
+
}
|
|
95
|
+
/** Make a profile that is already there the active one. False when there is no such name. */
|
|
96
|
+
export function activate(name, home = pinecallHome()) {
|
|
97
|
+
const config = readConfig(home);
|
|
98
|
+
if (config.profiles[name] === undefined)
|
|
99
|
+
return false;
|
|
100
|
+
config.active = name;
|
|
101
|
+
writeConfig(config, home);
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Forget a gateway. False when there is no such name, so a typo is never silence.
|
|
106
|
+
*
|
|
107
|
+
* A profile is a key in a file, and a key that opens nothing is worse than none: somebody will
|
|
108
|
+
* trust it tomorrow and read the refusal as the gateway's fault. This is the only way to take one
|
|
109
|
+
* out, and it takes the active mark with it rather than leaving it pointing at a row that is gone.
|
|
110
|
+
*/
|
|
111
|
+
export function forget(name, home = pinecallHome()) {
|
|
112
|
+
const config = readConfig(home);
|
|
113
|
+
if (config.profiles[name] === undefined)
|
|
114
|
+
return false;
|
|
115
|
+
const { [name]: _gone, ...left } = config.profiles;
|
|
116
|
+
const active = config.active === name ? undefined : config.active;
|
|
117
|
+
writeConfig({ ...(active === undefined ? {} : { active }), profiles: left }, home);
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
/** The phone this person calls FROM at the gateway in hand, so a ring reaches their own agent. */
|
|
121
|
+
export function callingFrom(home = pinecallHome()) {
|
|
122
|
+
return profileFor(theChosenProfile(), home)?.calling;
|
|
123
|
+
}
|
|
124
|
+
/** Say which phone is yours here, or take it back. False when there is no profile to write it on. */
|
|
125
|
+
export function callsFrom(number, home = pinecallHome()) {
|
|
126
|
+
const config = readConfig(home);
|
|
127
|
+
const name = theChosenProfile() ?? config.active;
|
|
128
|
+
if (name === undefined || config.profiles[name] === undefined)
|
|
129
|
+
return false;
|
|
130
|
+
const { calling: _was, ...rest } = config.profiles[name];
|
|
131
|
+
return amend(name, number === undefined ? rest : { ...rest, calling: number }, home, true);
|
|
132
|
+
}
|
|
133
|
+
/** Change one field of a profile without touching its key: what `line from` writes. */
|
|
134
|
+
export function amend(name, fields, home = pinecallHome(), whole = false) {
|
|
135
|
+
const config = readConfig(home);
|
|
136
|
+
const profile = config.profiles[name];
|
|
137
|
+
if (profile === undefined)
|
|
138
|
+
return false;
|
|
139
|
+
// `whole` is how a field is REMOVED: merging cannot unset one, and `line forget` has to.
|
|
140
|
+
config.profiles[name] = whole ? { ...fields } : { ...profile, ...fields };
|
|
141
|
+
writeConfig(config, home);
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* What to call a profile for this gateway: the host's first label, and `local` for a loopback.
|
|
146
|
+
*
|
|
147
|
+
* A name is for a person to type — `pinecall use box` — so it is short and it is theirs to
|
|
148
|
+
* override with `--as`. A second gateway that would take a name already spoken for gets a number,
|
|
149
|
+
* because silently repointing a name is how somebody deploys to the wrong box.
|
|
150
|
+
*/
|
|
151
|
+
export function nameFor(url, config) {
|
|
152
|
+
const wanted = defaultName(url);
|
|
153
|
+
const taken = (name) => config.profiles[name] !== undefined && normalised(config.profiles[name].url) !== normalised(url);
|
|
154
|
+
if (!taken(wanted))
|
|
155
|
+
return wanted;
|
|
156
|
+
for (let at = 2;; at += 1) {
|
|
157
|
+
if (!taken(`${wanted}-${at}`))
|
|
158
|
+
return `${wanted}-${at}`;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/** Whichever profile points at this gateway, by name, when one does. */
|
|
162
|
+
export function nameOfGateway(url, config) {
|
|
163
|
+
const wanted = normalised(url);
|
|
164
|
+
return Object.keys(config.profiles).find((name) => normalised(config.profiles[name].url) === wanted);
|
|
165
|
+
}
|
|
166
|
+
function defaultName(url) {
|
|
167
|
+
try {
|
|
168
|
+
const host = new URL(url).hostname;
|
|
169
|
+
if (host === "localhost" || host === "127.0.0.1" || host === "::1")
|
|
170
|
+
return "local";
|
|
171
|
+
return host.split(".")[0] ?? host;
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
return "gateway";
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function parsedConfig(home) {
|
|
178
|
+
const read = readJson(home);
|
|
179
|
+
if (read === undefined)
|
|
180
|
+
return undefined;
|
|
181
|
+
const profiles = read["profiles"];
|
|
182
|
+
if (typeof profiles !== "object" || profiles === null || Array.isArray(profiles))
|
|
183
|
+
return undefined;
|
|
184
|
+
const config = { profiles: profiles };
|
|
185
|
+
if (typeof read["active"] === "string")
|
|
186
|
+
config.active = read["active"];
|
|
187
|
+
return config;
|
|
188
|
+
}
|
|
189
|
+
// A missing file, an unreadable one and a broken one are all the same answer: nothing. A config
|
|
190
|
+
// nobody can parse must not stop a verb from saying it has no profile — that sentence is the fix.
|
|
191
|
+
function readJson(home) {
|
|
192
|
+
try {
|
|
193
|
+
const read = JSON.parse(readFileSync(join(home, CONFIG), "utf8"));
|
|
194
|
+
return typeof read === "object" && read !== null && !Array.isArray(read)
|
|
195
|
+
? read
|
|
196
|
+
: undefined;
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
return undefined;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function writeConfig(config, home) {
|
|
203
|
+
mkdirSync(home, { recursive: true, mode: DIRECTORY_MODE });
|
|
204
|
+
const path = join(home, CONFIG);
|
|
205
|
+
writeFileSync(path, `${JSON.stringify(config, null, 2)}\n`, { mode: FILE_MODE });
|
|
206
|
+
// writeFileSync's mode applies only when it creates the file: one already there kept what it
|
|
207
|
+
// had, including a mode an editor widened.
|
|
208
|
+
chmodSync(path, FILE_MODE);
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=profiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../src/cli/profiles.ts"],"names":[],"mappings":"AAAA,mGAAmG;AAEnG,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE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KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;YACtE,CAAC,CAAE,IAAgC;YACnC,CAAC,CAAC,SAAS,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,MAAc,EAAE,IAAY;IAC/C,SAAS,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;IAC3D,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAChC,aAAa,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;IACjF,6FAA6F;IAC7F,2CAA2C;IAC3C,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** `pinecall prompt [agent.tsx] --state file`: the exact prompt a state would produce, offline. */
|
|
2
|
+
import type { Snapshot } from "../agent/state.js";
|
|
3
|
+
import type { Group } from "./groups.js";
|
|
4
|
+
export declare const group: Group;
|
|
5
|
+
/**
|
|
6
|
+
* No runtime, no gateway, no key: load the class, put it in the state the goldens describe, and
|
|
7
|
+
* print every block of the prompt under its header, and under them the stage and the tools it shows. This
|
|
8
|
+
* is the verb a person runs while writing a render, and it must answer in the time it takes to save
|
|
9
|
+
* the file.
|
|
10
|
+
*/
|
|
11
|
+
export declare function run(argv: string[], out?: NodeJS.WritableStream, err?: NodeJS.WritableStream): Promise<number>;
|
|
12
|
+
/**
|
|
13
|
+
* The state of one case of a goldens file — the first, or the one `--case N` names.
|
|
14
|
+
*
|
|
15
|
+
* The file is the design's `test/choose.json`: an array of cases, each with its own `state`. A
|
|
16
|
+
* single object is read as one case too, because a person writing a render by hand should not have
|
|
17
|
+
* to wrap it in brackets to see what it renders.
|
|
18
|
+
*/
|
|
19
|
+
export declare function firstState(file: string, which: string | undefined): Snapshot;
|
|
20
|
+
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/cli/prompt.ts"],"names":[],"mappings":"AAAA,mGAAmG;AAKnG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAQzC,eAAO,MAAM,KAAK,EAAE,KAYnB,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,GAAG,CACvB,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,GAAE,MAAM,CAAC,cAA+B,EAC3C,GAAG,GAAE,MAAM,CAAC,cAA+B,GAC1C,OAAO,CAAC,MAAM,CAAC,CAejB;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,CAO5E"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/** `pinecall prompt [agent.tsx] --state file`: the exact prompt a state would produce, offline. */
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { parseArgs } from "node:util";
|
|
4
|
+
import { showPrompt } from "../views/render.js";
|
|
5
|
+
import { showMachine } from "./machine.js";
|
|
6
|
+
import { instanceFor, load } from "./load.js";
|
|
7
|
+
export const group = {
|
|
8
|
+
purpose: "the exact prompt a state would produce, offline",
|
|
9
|
+
usage: `usage: pinecall prompt [agent.tsx] --state <file> [--case n]
|
|
10
|
+
|
|
11
|
+
The three regions of the prompt as the model would receive them — the static prefix, the
|
|
12
|
+
history, the dynamic blocks at the end — and under them the stage and the tools that stage
|
|
13
|
+
shows. No gateway, no key, no call: the class is loaded here and put in the state the file
|
|
14
|
+
describes, so this answers in the time it takes to save the file.
|
|
15
|
+
|
|
16
|
+
--state file a goldens file: an array of cases, each with its own \`state\`, or one object
|
|
17
|
+
--case n which case of that file, when it holds several (default 0)`,
|
|
18
|
+
run,
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* No runtime, no gateway, no key: load the class, put it in the state the goldens describe, and
|
|
22
|
+
* print every block of the prompt under its header, and under them the stage and the tools it shows. This
|
|
23
|
+
* is the verb a person runs while writing a render, and it must answer in the time it takes to save
|
|
24
|
+
* the file.
|
|
25
|
+
*/
|
|
26
|
+
export async function run(argv, out = process.stdout, err = process.stderr) {
|
|
27
|
+
const { values, positionals } = parseArgs({
|
|
28
|
+
args: argv,
|
|
29
|
+
allowPositionals: true,
|
|
30
|
+
options: { state: { type: "string" }, case: { type: "string" } },
|
|
31
|
+
});
|
|
32
|
+
if (values.state === undefined) {
|
|
33
|
+
err.write("pinecall prompt: --state <file> is required\n");
|
|
34
|
+
return 2;
|
|
35
|
+
}
|
|
36
|
+
const loaded = await load(positionals[0]);
|
|
37
|
+
const agent = instanceFor(loaded);
|
|
38
|
+
agent.startIn(firstState(values.state, values.case));
|
|
39
|
+
out.write(`${showPrompt(agent)}\n\n${showMachine(agent)}\n`);
|
|
40
|
+
return 0;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The state of one case of a goldens file — the first, or the one `--case N` names.
|
|
44
|
+
*
|
|
45
|
+
* The file is the design's `test/choose.json`: an array of cases, each with its own `state`. A
|
|
46
|
+
* single object is read as one case too, because a person writing a render by hand should not have
|
|
47
|
+
* to wrap it in brackets to see what it renders.
|
|
48
|
+
*/
|
|
49
|
+
export function firstState(file, which) {
|
|
50
|
+
const parsed = JSON.parse(readFileSync(file, "utf8"));
|
|
51
|
+
const cases = Array.isArray(parsed) ? parsed : [parsed];
|
|
52
|
+
const index = which === undefined ? 0 : Number(which);
|
|
53
|
+
const chosen = cases[index];
|
|
54
|
+
if (chosen === undefined)
|
|
55
|
+
throw new Error(`${file} has no case ${index}`);
|
|
56
|
+
return chosen.state ?? {};
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/cli/prompt.ts"],"names":[],"mappings":"AAAA,mGAAmG;AAEnG,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAO9C,MAAM,CAAC,MAAM,KAAK,GAAU;IAC1B,OAAO,EAAE,iDAAiD;IAC1D,KAAK,EAAE;;;;;;;;6EAQoE;IAC3E,GAAG;CACJ,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CACvB,IAAc,EACd,GAAG,GAA0B,OAAO,CAAC,MAAM,EAC3C,GAAG,GAA0B,OAAO,CAAC,MAAM;IAE3C,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC;QACxC,IAAI,EAAE,IAAI;QACV,gBAAgB,EAAE,IAAI;QACtB,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;KACjE,CAAC,CAAC;IACH,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC/B,GAAG,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;QAC3D,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IACrD,GAAG,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7D,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,KAAyB;IAChE,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAkB,CAAC;IACvE,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACxD,MAAM,KAAK,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IAC5B,IAAI,MAAM,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,gBAAgB,KAAK,EAAE,CAAC,CAAC;IAC1E,OAAO,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** `pinecall providers add | rm | list`: the keys this org brought of its own, never read back. */
|
|
2
|
+
import type { Group } from "./groups.js";
|
|
3
|
+
export declare const group: Group;
|
|
4
|
+
/** What the verb can be told besides the argv: where to print, which environment, and the key. */
|
|
5
|
+
export interface Bringing {
|
|
6
|
+
out?: NodeJS.WritableStream;
|
|
7
|
+
err?: NodeJS.WritableStream;
|
|
8
|
+
env?: NodeJS.ProcessEnv;
|
|
9
|
+
/** How the key arrives. A test hands one in rather than driving a terminal. */
|
|
10
|
+
key?: () => Promise<string>;
|
|
11
|
+
}
|
|
12
|
+
/** Read the sub-verb and do it: one key up, one key gone, or the vendors this org brought. */
|
|
13
|
+
export declare function run(argv: string[], how?: Bringing): Promise<number>;
|
|
14
|
+
//# sourceMappingURL=providers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/cli/providers.ts"],"names":[],"mappings":"AAAA,mGAAmG;AAGnG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAUzC,eAAO,MAAM,KAAK,EAAE,KAqBnB,CAAC;AAEF,kGAAkG;AAClG,MAAM,WAAW,QAAQ;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,+EAA+E;IAC/E,GAAG,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED,8FAA8F;AAC9F,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,GAAE,QAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAmB7E"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/** `pinecall providers add | rm | list`: the keys this org brought of its own, never read back. */
|
|
2
|
+
import { theDoor } from "./env.js";
|
|
3
|
+
import { aLineOfStdin, typedInSilence } from "./secret.js";
|
|
4
|
+
import { asked } from "./testing/gateway.js";
|
|
5
|
+
import { refusal } from "./whoami.js";
|
|
6
|
+
const USAGE = `usage: pinecall providers [--does llm|stt|tts] every vendor this build runs
|
|
7
|
+
pinecall providers add <vendor> the key on stdin, never on the command line
|
|
8
|
+
pinecall providers rm <vendor>
|
|
9
|
+
pinecall providers list only the ones this org brought`;
|
|
10
|
+
export const group = {
|
|
11
|
+
purpose: "every vendor this build runs, and the provider keys this org brought of its own",
|
|
12
|
+
usage: `${USAGE}
|
|
13
|
+
|
|
14
|
+
With nothing after it: every vendor this build runs — what each does, every other word it
|
|
15
|
+
answers to, and the one word for what it is still waiting for on this box. \`ready\` is the only
|
|
16
|
+
one that runs a call; \`no plugin\` and \`no key\` are the operator's to fix, and \`its own\` is a
|
|
17
|
+
vendor whose credentials are a chain or a pair and never one key anybody could bring.
|
|
18
|
+
|
|
19
|
+
A key added here is this org's own account with that vendor, and every call of this org runs
|
|
20
|
+
on it from the next one; every vendor nobody brought runs on the box's own key. add reads the
|
|
21
|
+
key from stdin — typed with nothing echoed on a terminal, one piped line off one — and never
|
|
22
|
+
from a flag: argv is visible in \`ps\` to every user on the box, and a key pasted as an argument
|
|
23
|
+
is a key in the shell history. rm gives that vendor back to the box's key.
|
|
24
|
+
|
|
25
|
+
No door a person reads ever answers with a provider key: list prints the vendors and nothing
|
|
26
|
+
else, not a value, not a prefix, not a fingerprint. The one door that does read a key back is
|
|
27
|
+
the worker's — GET /v1/agents/<slug>/provider-keys, an org's own keys to an org's own process,
|
|
28
|
+
on that org's key — and it is the whole reason the vault exists. A key that was lost is set
|
|
29
|
+
again.`,
|
|
30
|
+
run,
|
|
31
|
+
};
|
|
32
|
+
/** Read the sub-verb and do it: one key up, one key gone, or the vendors this org brought. */
|
|
33
|
+
export async function run(argv, how = {}) {
|
|
34
|
+
const out = how.out ?? process.stdout;
|
|
35
|
+
const err = how.err ?? process.stderr;
|
|
36
|
+
const [verb, vendor] = argv;
|
|
37
|
+
const door = theDoor(how.env ?? process.env, err);
|
|
38
|
+
if (door === undefined)
|
|
39
|
+
return 2;
|
|
40
|
+
try {
|
|
41
|
+
if (verb === undefined || verb === "--does")
|
|
42
|
+
return await catalogue(door, vendor, out, err);
|
|
43
|
+
if (verb === "add" && vendor !== undefined)
|
|
44
|
+
return await add(door, vendor, how.key, out, err);
|
|
45
|
+
if (verb === "rm" && vendor !== undefined)
|
|
46
|
+
return await remove(door, vendor, out);
|
|
47
|
+
if (verb === "list")
|
|
48
|
+
return await list(door, out);
|
|
49
|
+
}
|
|
50
|
+
catch (refused) {
|
|
51
|
+
// The gateway's own sentence, as it was said: "no vendor named 11labs; this build runs: …"
|
|
52
|
+
// names the fix, and nothing here knows better. It never carries the key back.
|
|
53
|
+
err.write(`${refusal(refused)}\n`);
|
|
54
|
+
return 1;
|
|
55
|
+
}
|
|
56
|
+
err.write(`${USAGE}\n`);
|
|
57
|
+
return 2;
|
|
58
|
+
}
|
|
59
|
+
// The key never touches the argv and never reaches a log: it is read here, sent once, and the
|
|
60
|
+
// only thing printed afterwards is the vendor it was stored under.
|
|
61
|
+
async function add(door, vendor, given, out, err) {
|
|
62
|
+
const key = (await (given ?? (() => aKeyFor(vendor, out)))()).trim();
|
|
63
|
+
if (key === "") {
|
|
64
|
+
err.write("no key was given: nothing was brought\n");
|
|
65
|
+
return 2;
|
|
66
|
+
}
|
|
67
|
+
await asked(door, pathFor(vendor), { method: "PUT", body: { key } });
|
|
68
|
+
out.write(`${vendor}\n`);
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
async function remove(door, vendor, out) {
|
|
72
|
+
await asked(door, pathFor(vendor), { method: "DELETE" });
|
|
73
|
+
out.write(`${vendor}\n`);
|
|
74
|
+
return 0;
|
|
75
|
+
}
|
|
76
|
+
async function list(door, out) {
|
|
77
|
+
const brought = await asked(door, "/v1/provider-keys");
|
|
78
|
+
if (brought.vendors.length === 0) {
|
|
79
|
+
out.write("no provider key brought: every call runs on the keys of the box\n");
|
|
80
|
+
return 0;
|
|
81
|
+
}
|
|
82
|
+
for (const vendor of brought.vendors)
|
|
83
|
+
out.write(`${vendor}\n`);
|
|
84
|
+
return 0;
|
|
85
|
+
}
|
|
86
|
+
const MODALITIES = ["llm", "stt", "tts"];
|
|
87
|
+
// The whole table, one line each, in the catalog's own order. It is the answer to "can I use
|
|
88
|
+
// Cartesia" — which used to be answered by typing `cartesia` into a form and being told by the
|
|
89
|
+
// gateway that no such vendor existed, from a build that was one install away from having it.
|
|
90
|
+
async function catalogue(door, does, out, err) {
|
|
91
|
+
if (does !== undefined && !MODALITIES.includes(does)) {
|
|
92
|
+
err.write(`no modality called ${does}: ${MODALITIES.join(" | ")}\n`);
|
|
93
|
+
return 2;
|
|
94
|
+
}
|
|
95
|
+
const said = await asked(door, "/v1/providers");
|
|
96
|
+
const shown = does === undefined ? said.providers : said.providers.filter((one) => one.does.includes(does));
|
|
97
|
+
const rows = shown.map((one) => [one.name, one.does.join(","), one.standing, one.env ?? "", one.aliases.join(" ")]);
|
|
98
|
+
for (const line of asColumns([["vendor", "does", "standing", "variable", "also known as"], ...rows]))
|
|
99
|
+
out.write(`${line}\n`);
|
|
100
|
+
const ours = Object.entries(said.defaults).map(([job, vendor]) => `${job} ${vendor}`);
|
|
101
|
+
out.write(`\n${rows.length} vendors · ours: ${ours.join(" · ")}\n`);
|
|
102
|
+
return 0;
|
|
103
|
+
}
|
|
104
|
+
/** Every column as wide as its widest value: nothing is cut to make a table line up. */
|
|
105
|
+
function asColumns(rows) {
|
|
106
|
+
const widths = rows[0].map((_, column) => Math.max(...rows.map((row) => (row[column] ?? "").length)));
|
|
107
|
+
return rows.map((row) => row.map((value, column) => (value ?? "").padEnd(widths[column])).join(" ").trimEnd());
|
|
108
|
+
}
|
|
109
|
+
/** Typed with nothing echoed when a person is there, and one piped line when nobody is. */
|
|
110
|
+
async function aKeyFor(vendor, out) {
|
|
111
|
+
return process.stdin.isTTY === true ? await typedInSilence(`${vendor} key: `, out) : await aLineOfStdin();
|
|
112
|
+
}
|
|
113
|
+
function pathFor(vendor) {
|
|
114
|
+
return `/v1/provider-keys/${encodeURIComponent(vendor)}`;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=providers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.js","sourceRoot":"","sources":["../../src/cli/providers.ts"],"names":[],"mappings":"AAAA,mGAAmG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AG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AACnH,CAAC;AAED,2FAA2F;AAC3F,KAAK,UAAU,OAAO,CAAC,MAAc,EAAE,GAA0B;IAC/D,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,cAAc,CAAC,GAAG,MAAM,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,YAAY,EAAE,CAAC;AAC5G,CAAC;AAED,SAAS,OAAO,CAAC,MAAc;IAC7B,OAAO,qBAAqB,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** `pinecall remember [paths]`: the goldens `memory.remember` is held to — what a call teaches, and what it must never keep. */
|
|
2
|
+
import type { ExtractionGolden, ExtractionRun } from "@pinecall/protocol";
|
|
3
|
+
import type { Group } from "./groups.js";
|
|
4
|
+
import { type Door } from "./testing/gateway.js";
|
|
5
|
+
/**
|
|
6
|
+
* Where the extraction goldens live. `test/goldens` is the conversation ring and its files are a
|
|
7
|
+
* different shape, so these get a directory of their own rather than a key inside a crowded one.
|
|
8
|
+
*/
|
|
9
|
+
export declare const CASES = "test/memory";
|
|
10
|
+
export declare const NO_CASES = "no extraction goldens at test/memory: write one, or name the file or directory to run";
|
|
11
|
+
export declare const group: Group;
|
|
12
|
+
/** What the verb can be told besides the argv: where to print, and which environment. Tests only. */
|
|
13
|
+
export interface Running {
|
|
14
|
+
out?: NodeJS.WritableStream;
|
|
15
|
+
err?: NodeJS.WritableStream;
|
|
16
|
+
env?: NodeJS.ProcessEnv;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The class is mounted HERE, exactly as `pinecall test` mounts it, because the categories a golden
|
|
20
|
+
* may name and the tool names admission refuses a fact for are the class's OWN declaration — the
|
|
21
|
+
* gateway reads it off the socket this process opens. The extraction itself runs there: the org's
|
|
22
|
+
* model and the org's provider keys are the gateway's and never this terminal's.
|
|
23
|
+
*/
|
|
24
|
+
export declare function run(argv: string[], how?: Running): Promise<number>;
|
|
25
|
+
/** The one door: every case through one extraction each, judged by code where the model lives. */
|
|
26
|
+
export declare function extracted(door: Door, agent: string, cases: ExtractionGolden[]): Promise<ExtractionRun>;
|
|
27
|
+
/** The run as a person reads it: one line, then the evidence under the cases that did not hold. */
|
|
28
|
+
export declare function linesOf(answer: ExtractionRun): string[];
|
|
29
|
+
//# sourceMappingURL=remember.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remember.d.ts","sourceRoot":"","sources":["../../src/cli/remember.ts"],"names":[],"mappings":"AAAA,gIAAgI;AAKhI,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAM1E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAS,KAAK,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAKxD;;;GAGG;AACH,eAAO,MAAM,KAAK,gBAAgB,CAAC;AAEnC,eAAO,MAAM,QAAQ,0FAAuF,CAAC;AAI7G,eAAO,MAAM,KAAK,EAAE,KAanB,CAAC;AAEF,qGAAqG;AACrG,MAAM,WAAW,OAAO;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,GAAE,OAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAuC5E;AAED,kGAAkG;AAClG,wBAAsB,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAK5G;AAED,mGAAmG;AACnG,wBAAgB,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,EAAE,CAkBvD"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/** `pinecall remember [paths]`: the goldens `memory.remember` is held to — what a call teaches, and what it must never keep. */
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { parseArgs } from "node:util";
|
|
4
|
+
import { Pinecall } from "../client/index.js";
|
|
5
|
+
import { mount } from "../runtime/connect.js";
|
|
6
|
+
import { theDoor } from "./env.js";
|
|
7
|
+
import { load, mountOptions } from "./load.js";
|
|
8
|
+
import { asked } from "./testing/gateway.js";
|
|
9
|
+
import { casesIn, matching } from "./testing/goldens.js";
|
|
10
|
+
import { BROKEN, HELD } from "./testing/score.js";
|
|
11
|
+
import { refusal } from "./whoami.js";
|
|
12
|
+
/**
|
|
13
|
+
* Where the extraction goldens live. `test/goldens` is the conversation ring and its files are a
|
|
14
|
+
* different shape, so these get a directory of their own rather than a key inside a crowded one.
|
|
15
|
+
*/
|
|
16
|
+
export const CASES = "test/memory";
|
|
17
|
+
export const NO_CASES = `no extraction goldens at ${CASES}: write one, or name the file or directory to run`;
|
|
18
|
+
const USAGE = "usage: pinecall remember [paths] [--file agent.tsx] [--grep x] [--json]";
|
|
19
|
+
export const group = {
|
|
20
|
+
purpose: "the goldens memory.remember is held to: what a call teaches, and what it never keeps",
|
|
21
|
+
usage: `${USAGE}
|
|
22
|
+
|
|
23
|
+
A case is one call written down — both speakers, because nothing is re-run — the facts memory
|
|
24
|
+
already holds, and what must come of it: which categories got a fact, which never did, which
|
|
25
|
+
values must not survive in any fact's text, and which held facts the call contradicted.
|
|
26
|
+
|
|
27
|
+
Each case costs ONE model call, the very one a hang-up makes, run by the gateway on the org's
|
|
28
|
+
own keys against the class this terminal is holding. Every answer is judged by code: a category
|
|
29
|
+
is the class's own word, a value is a literal, a supersession is an id — never one sentence
|
|
30
|
+
compared to another, because two ways of writing one fact are one fact.`,
|
|
31
|
+
run,
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The class is mounted HERE, exactly as `pinecall test` mounts it, because the categories a golden
|
|
35
|
+
* may name and the tool names admission refuses a fact for are the class's OWN declaration — the
|
|
36
|
+
* gateway reads it off the socket this process opens. The extraction itself runs there: the org's
|
|
37
|
+
* model and the org's provider keys are the gateway's and never this terminal's.
|
|
38
|
+
*/
|
|
39
|
+
export async function run(argv, how = {}) {
|
|
40
|
+
const out = how.out ?? process.stdout;
|
|
41
|
+
const err = how.err ?? process.stderr;
|
|
42
|
+
const { values, positionals } = parseArgs({
|
|
43
|
+
args: argv,
|
|
44
|
+
allowPositionals: true,
|
|
45
|
+
options: {
|
|
46
|
+
file: { type: "string" },
|
|
47
|
+
grep: { type: "string" },
|
|
48
|
+
json: { type: "boolean", default: false },
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
const door = theDoor(how.env ?? process.env, err);
|
|
52
|
+
if (door === undefined)
|
|
53
|
+
return 2;
|
|
54
|
+
if (positionals.length === 0 && !existsSync(CASES)) {
|
|
55
|
+
err.write(`${NO_CASES}\n${USAGE}\n`);
|
|
56
|
+
return 2;
|
|
57
|
+
}
|
|
58
|
+
const cases = matching(await casesIn(positionals, CASES), values.grep);
|
|
59
|
+
if (cases.length === 0) {
|
|
60
|
+
err.write(`no case matched${values.grep === undefined ? "" : ` --grep ${values.grep}`}\n`);
|
|
61
|
+
return 2;
|
|
62
|
+
}
|
|
63
|
+
const loaded = await load(values.file);
|
|
64
|
+
const pc = new Pinecall({ url: door.url, apiKey: door.apiKey });
|
|
65
|
+
// takesUnclaimed: false for the reason `test` has it: this process holds the agent so the run
|
|
66
|
+
// reaches THIS class, and a real call must not ring in a terminal running a suite.
|
|
67
|
+
const mounted = mount(loaded.ctor, { ...mountOptions(loaded, pc), takesUnclaimed: false });
|
|
68
|
+
try {
|
|
69
|
+
await pc.connect();
|
|
70
|
+
const answer = await extracted(door, mounted.slug, cases);
|
|
71
|
+
out.write(values.json === true ? `${JSON.stringify(answer)}\n` : `${linesOf(answer).join("\n")}\n`);
|
|
72
|
+
return answer.held === answer.cases ? 0 : 1;
|
|
73
|
+
}
|
|
74
|
+
catch (refused) {
|
|
75
|
+
err.write(`${refusal(refused)}\n`);
|
|
76
|
+
return 1;
|
|
77
|
+
}
|
|
78
|
+
finally {
|
|
79
|
+
pc.close();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** The one door: every case through one extraction each, judged by code where the model lives. */
|
|
83
|
+
export async function extracted(door, agent, cases) {
|
|
84
|
+
return await asked(door, `/v1/agents/${encodeURIComponent(agent)}/memory/extraction`, {
|
|
85
|
+
method: "POST",
|
|
86
|
+
body: { cases },
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/** The run as a person reads it: one line, then the evidence under the cases that did not hold. */
|
|
90
|
+
export function linesOf(answer) {
|
|
91
|
+
const counted = `${answer.cases} case${answer.cases === 1 ? "" : "s"}`;
|
|
92
|
+
const lines = [
|
|
93
|
+
`${answer.agent} · ${answer.model} · ${counted} · ${answer.held} held · ${Math.round(answer.took_ms)} ms`,
|
|
94
|
+
];
|
|
95
|
+
for (const result of answer.results) {
|
|
96
|
+
if (result.held) {
|
|
97
|
+
lines.push(` ${HELD} ${result.name}`);
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
const broke = result.broke ?? [];
|
|
101
|
+
const width = Math.max(...broke.map((one) => one.check.length));
|
|
102
|
+
lines.push(` ${BROKEN} ${result.name}`);
|
|
103
|
+
for (const one of broke)
|
|
104
|
+
lines.push(` ${one.check.padEnd(width)} ${one.detail}`);
|
|
105
|
+
for (const wrote of result.wrote ?? [])
|
|
106
|
+
lines.push(` kept ${wrote}`);
|
|
107
|
+
for (const refused of result.refused ?? [])
|
|
108
|
+
lines.push(` refused ${refused}`);
|
|
109
|
+
}
|
|
110
|
+
return lines;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=remember.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remember.js","sourceRoot":"","sources":["../../src/cli/remember.ts"],"names":[],"mappings":"AAAA,gIAAgI;AAEhI,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAItC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAa,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC;;;GAGG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,aAAa,CAAC;AAEnC,MAAM,CAAC,MAAM,QAAQ,GAAG,4BAA4B,KAAK,mDAAmD,CAAC;AAE7G,MAAM,KAAK,GAAG,yEAAyE,CAAC;AAExF,MAAM,CAAC,MAAM,KAAK,GAAU;IAC1B,OAAO,EAAE,sFAAsF;IAC/F,KAAK,EAAE,GAAG,KAAK;;;;;;;;;0EASyD;IACxE,GAAG;CACJ,CAAC;AASF;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,IAAc,EAAE,GAAG,GAAY,EAAE;IACzD,MAAM,GAAG,G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AC,CAAC;QAC/E,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,OAAO,IAAI,EAAE;YAAE,KAAK,CAAC,IAAI,CAAC,mBAAmB,OAAO,EAAE,CAAC,CAAC;IACvF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** `pinecall run [agent.tsx]`: the app registered and answering — the process you deploy. */
|
|
2
|
+
import { type RouteInput } from "../client/index.js";
|
|
3
|
+
import type { Group } from "./groups.js";
|
|
4
|
+
export declare const group: Group;
|
|
5
|
+
/**
|
|
6
|
+
* Load the agent, mount it, connect, and stay up until the process is signalled.
|
|
7
|
+
*
|
|
8
|
+
* This is the verb that goes under pm2 and into a container, and it is the same process in
|
|
9
|
+
* the sandbox and in production: it runs the agent, binds no port and serves no page. What a
|
|
10
|
+
* person looks at is `--ui` in this terminal, or the log over the gateway's API.
|
|
11
|
+
* See docs/decisions/tenant-cli.md.
|
|
12
|
+
*/
|
|
13
|
+
export declare function run(argv: string[]): Promise<number>;
|
|
14
|
+
/** Where the console of this agent is, with the code that signs the browser in. */
|
|
15
|
+
export declare function consoleUrl(gateway: string, slug: string, code: string): string;
|
|
16
|
+
/** Why the console line has no URL in it, in words that name the next move. */
|
|
17
|
+
export declare function whyNoConsole(refused: unknown): string;
|
|
18
|
+
/** Whether this agent answers at a number at all: with no number there is no ring to land. */
|
|
19
|
+
export declare function rings(routes: RouteInput[] | undefined): boolean;
|
|
20
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAI7F,OAAO,EAA6B,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOhF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AA2BzC,eAAO,MAAM,KAAK,EAAE,KAcnB,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAwGzD;AASD,mFAAmF;AACnF,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9E;AAQD,+EAA+E;AAC/E,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAKrD;AA8BD,8FAA8F;AAC9F,wBAAgB,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,SAAS,GAAG,OAAO,CAE/D"}
|