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,311 @@
|
|
|
1
|
+
/** Docstrings at runtime: a class's own source, read by oxc's parser for its JSDoc and its parameters. */
|
|
2
|
+
import { parseSync } from "oxc-parser";
|
|
3
|
+
const registered = new WeakMap();
|
|
4
|
+
const scraped = new WeakMap();
|
|
5
|
+
/** An open object: the honest answer for a type this file cannot see the shape of. */
|
|
6
|
+
const ANY_OBJECT = { type: "object", additionalProperties: true };
|
|
7
|
+
/** Fold a JSDoc's lines into the one sentence a model should read, tags left out. */
|
|
8
|
+
function oneLine(value) {
|
|
9
|
+
const lines = [];
|
|
10
|
+
for (const raw of value.split("\n")) {
|
|
11
|
+
let line = raw.trim();
|
|
12
|
+
while (line.startsWith("*"))
|
|
13
|
+
line = line.slice(1).trim();
|
|
14
|
+
// A tag line ends the description: `@param` and friends are not part of the sentence.
|
|
15
|
+
if (line.startsWith("@"))
|
|
16
|
+
break;
|
|
17
|
+
if (line.length > 0)
|
|
18
|
+
lines.push(line);
|
|
19
|
+
}
|
|
20
|
+
const flat = lines.join(" ");
|
|
21
|
+
return flat.length > 0 ? flat : undefined;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The docstring attached to a position: the last JSDoc block that closed above it with nothing but
|
|
25
|
+
* whitespace in between. That gap is the whole definition of "attached" — decorators live inside
|
|
26
|
+
* the node's own span, so a decorated method is still reached by its comment.
|
|
27
|
+
*/
|
|
28
|
+
function docAt(start, source) {
|
|
29
|
+
let found;
|
|
30
|
+
for (const comment of source.jsdoc) {
|
|
31
|
+
if (comment.end > start)
|
|
32
|
+
break;
|
|
33
|
+
if (source.text.slice(comment.end, start).trim().length === 0)
|
|
34
|
+
found = comment;
|
|
35
|
+
}
|
|
36
|
+
return found ? oneLine(found.value) : undefined;
|
|
37
|
+
}
|
|
38
|
+
/** The type as the source writes it: the span the parser gives, read back out of the text. */
|
|
39
|
+
function textOf(node, source) {
|
|
40
|
+
return source.text.slice(node.start, node.end);
|
|
41
|
+
}
|
|
42
|
+
/** A statement as the file declares it, with `export` peeled off so both forms read the same. */
|
|
43
|
+
function declarationOf(statement) {
|
|
44
|
+
if (statement.type === "ExportNamedDeclaration" && statement.declaration)
|
|
45
|
+
return statement.declaration;
|
|
46
|
+
if (statement.type === "ExportDefaultDeclaration")
|
|
47
|
+
return statement.declaration;
|
|
48
|
+
return statement;
|
|
49
|
+
}
|
|
50
|
+
/** Every interface and type alias the file declares at its top level. */
|
|
51
|
+
function declaredTypes(body) {
|
|
52
|
+
const types = new Map();
|
|
53
|
+
for (const statement of body) {
|
|
54
|
+
const declared = declarationOf(statement);
|
|
55
|
+
if (declared.type === "TSInterfaceDeclaration" || declared.type === "TSTypeAliasDeclaration") {
|
|
56
|
+
types.set(declared.id.name, declared);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return types;
|
|
60
|
+
}
|
|
61
|
+
/** The class this source is about, and where its docstring may sit: the `export default` if there is one. */
|
|
62
|
+
function theClass(body) {
|
|
63
|
+
let first;
|
|
64
|
+
for (const statement of body) {
|
|
65
|
+
const declared = declarationOf(statement);
|
|
66
|
+
if (declared.type !== "ClassDeclaration" && declared.type !== "ClassExpression")
|
|
67
|
+
continue;
|
|
68
|
+
const found = { node: declared, start: docstringEnd(declared, statement.start) };
|
|
69
|
+
if (statement.type === "ExportDefaultDeclaration")
|
|
70
|
+
return found;
|
|
71
|
+
first ??= found;
|
|
72
|
+
}
|
|
73
|
+
return first;
|
|
74
|
+
}
|
|
75
|
+
// Where the class's own docstring has to stop. A decorator is written between the JSDoc and the
|
|
76
|
+
// class — `@render(Prompt)` above `export default class` — and the parser puts the statement's
|
|
77
|
+
// start after it, so a docstring read up to the statement would find the decorator in the way and
|
|
78
|
+
// give up. The docstring of a decorated class is the comment above its FIRST decorator.
|
|
79
|
+
function docstringEnd(declared, start) {
|
|
80
|
+
const decorators = declared.decorators ?? [];
|
|
81
|
+
return decorators.reduce((earliest, decorator) => Math.min(earliest, decorator.start), start);
|
|
82
|
+
}
|
|
83
|
+
/** `undefined` and `null` inside a union: what makes the parameter optional instead of a type. */
|
|
84
|
+
function isNothing(node) {
|
|
85
|
+
return node.type === "TSUndefinedKeyword" || node.type === "TSNullKeyword";
|
|
86
|
+
}
|
|
87
|
+
/** The JSON Schema of a type the model must fill, following aliases declared in the same file. */
|
|
88
|
+
function jsonOf(node, types, seen) {
|
|
89
|
+
if (node.type === "TSStringKeyword")
|
|
90
|
+
return { type: "string" };
|
|
91
|
+
if (node.type === "TSNumberKeyword")
|
|
92
|
+
return { type: "number" };
|
|
93
|
+
if (node.type === "TSBooleanKeyword")
|
|
94
|
+
return { type: "boolean" };
|
|
95
|
+
// A callback is the app's own plumbing — the tool takes it, the model never writes one.
|
|
96
|
+
if (node.type === "TSFunctionType")
|
|
97
|
+
return { description: "callback" };
|
|
98
|
+
if (node.type === "TSArrayType")
|
|
99
|
+
return { type: "array", items: jsonOf(node.elementType, types, seen) };
|
|
100
|
+
if (node.type === "TSParenthesizedType")
|
|
101
|
+
return jsonOf(node.typeAnnotation, types, seen);
|
|
102
|
+
if (node.type === "TSTypeLiteral")
|
|
103
|
+
return objectOf(node.members, types, seen);
|
|
104
|
+
if (node.type === "TSUnionType")
|
|
105
|
+
return unionOf(node.types, types, seen);
|
|
106
|
+
if (node.type === "TSLiteralType")
|
|
107
|
+
return literalOf(node);
|
|
108
|
+
if (node.type === "TSTypeReference" && node.typeName.type === "Identifier") {
|
|
109
|
+
return referenceOf(node.typeName.name, types, seen);
|
|
110
|
+
}
|
|
111
|
+
return { ...ANY_OBJECT };
|
|
112
|
+
}
|
|
113
|
+
/** A type name followed one level into the file that declares it; a name from elsewhere stays a name. */
|
|
114
|
+
function referenceOf(name, types, seen) {
|
|
115
|
+
// A type that contains itself would expand forever; the name is what a model gets instead.
|
|
116
|
+
const declared = seen.has(name) ? undefined : types.get(name);
|
|
117
|
+
if (!declared)
|
|
118
|
+
return { type: "object", description: name };
|
|
119
|
+
const deeper = new Set(seen).add(name);
|
|
120
|
+
if (declared.type === "TSInterfaceDeclaration")
|
|
121
|
+
return objectOf(declared.body.body, types, deeper);
|
|
122
|
+
return jsonOf(declared.typeAnnotation, types, deeper);
|
|
123
|
+
}
|
|
124
|
+
/** The members of an interface or an object type, as properties and the ones that are required. */
|
|
125
|
+
function objectOf(members, types, seen) {
|
|
126
|
+
const properties = {};
|
|
127
|
+
const required = [];
|
|
128
|
+
for (const member of members) {
|
|
129
|
+
if (member.type !== "TSPropertySignature" || member.key.type !== "Identifier")
|
|
130
|
+
continue;
|
|
131
|
+
const type = member.typeAnnotation?.typeAnnotation;
|
|
132
|
+
properties[member.key.name] = type ? jsonOf(type, types, seen) : { ...ANY_OBJECT };
|
|
133
|
+
if (!member.optional)
|
|
134
|
+
required.push(member.key.name);
|
|
135
|
+
}
|
|
136
|
+
return { type: "object", properties, required, additionalProperties: false };
|
|
137
|
+
}
|
|
138
|
+
/** The value a literal type carries; a template or an expression carries none. */
|
|
139
|
+
function valueOf(node) {
|
|
140
|
+
if (node.type !== "TSLiteralType")
|
|
141
|
+
return undefined;
|
|
142
|
+
return "value" in node.literal ? node.literal.value : undefined;
|
|
143
|
+
}
|
|
144
|
+
/** `'a' | 'b'` is a string a model must choose from; anything wider is just an object. */
|
|
145
|
+
function unionOf(members, types, seen) {
|
|
146
|
+
const real = members.filter((one) => !isNothing(one));
|
|
147
|
+
if (real.length === 1 && real[0])
|
|
148
|
+
return jsonOf(real[0], types, seen);
|
|
149
|
+
const values = real.map(valueOf).filter((value) => typeof value === "string");
|
|
150
|
+
if (values.length === real.length && real.length > 0)
|
|
151
|
+
return { type: "string", enum: values };
|
|
152
|
+
return { ...ANY_OBJECT };
|
|
153
|
+
}
|
|
154
|
+
/** A literal type is its own value's type: `'a'` is a string, `1` a number, `true` a boolean. */
|
|
155
|
+
function literalOf(node) {
|
|
156
|
+
const value = valueOf(node);
|
|
157
|
+
if (typeof value === "string")
|
|
158
|
+
return { type: "string", enum: [value] };
|
|
159
|
+
if (typeof value === "number")
|
|
160
|
+
return { type: "number" };
|
|
161
|
+
if (typeof value === "boolean")
|
|
162
|
+
return { type: "boolean" };
|
|
163
|
+
return { ...ANY_OBJECT };
|
|
164
|
+
}
|
|
165
|
+
/** A type the text alone already describes: the registry maps those, so no schema is carried. */
|
|
166
|
+
function plainType(node) {
|
|
167
|
+
if (node.type === "TSStringKeyword")
|
|
168
|
+
return true;
|
|
169
|
+
if (node.type === "TSNumberKeyword")
|
|
170
|
+
return true;
|
|
171
|
+
if (node.type === "TSBooleanKeyword")
|
|
172
|
+
return true;
|
|
173
|
+
if (node.type === "TSFunctionType")
|
|
174
|
+
return true;
|
|
175
|
+
return node.type === "TSArrayType" && plainType(node.elementType);
|
|
176
|
+
}
|
|
177
|
+
/** One parameter: its name, the type as the source writes it, and whether it may be left out. */
|
|
178
|
+
function paramOf(node, source, types) {
|
|
179
|
+
const defaulted = node.type === "AssignmentPattern";
|
|
180
|
+
const binding = (defaulted ? node.left : node);
|
|
181
|
+
// A destructured parameter names no field a model could fill, so it is not offered as one.
|
|
182
|
+
if (binding.type !== "Identifier")
|
|
183
|
+
return undefined;
|
|
184
|
+
let type = binding.typeAnnotation?.typeAnnotation;
|
|
185
|
+
let optional = defaulted || Boolean(binding.optional);
|
|
186
|
+
if (type?.type === "TSUnionType") {
|
|
187
|
+
const real = type.types.filter((one) => !isNothing(one));
|
|
188
|
+
if (real.length < type.types.length)
|
|
189
|
+
optional = true;
|
|
190
|
+
if (real.length === 1 && real[0])
|
|
191
|
+
type = real[0];
|
|
192
|
+
}
|
|
193
|
+
const param = { name: binding.name, optional };
|
|
194
|
+
if (type)
|
|
195
|
+
param.type = textOf(type, source);
|
|
196
|
+
if (type && !plainType(type))
|
|
197
|
+
param.schema = jsonOf(type, types, new Set());
|
|
198
|
+
return param;
|
|
199
|
+
}
|
|
200
|
+
/** The parameters a class member declares — a method has its own, a field has a function's or none. */
|
|
201
|
+
function paramsOf(member, source, types) {
|
|
202
|
+
const holder = member.type === "MethodDefinition"
|
|
203
|
+
? member.value
|
|
204
|
+
: member.type === "PropertyDefinition" &&
|
|
205
|
+
(member.value?.type === "ArrowFunctionExpression" || member.value?.type === "FunctionExpression")
|
|
206
|
+
? member.value
|
|
207
|
+
: undefined;
|
|
208
|
+
if (!holder || holder.type === "TSEmptyBodyFunctionExpression")
|
|
209
|
+
return [];
|
|
210
|
+
return holder.params.map((param) => paramOf(param, source, types)).filter((param) => param !== undefined);
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Read a class's JSDoc and method signatures out of source text. Works on the real file (types and
|
|
214
|
+
* the class's own docstring included) and on `Ctor.toString()` (the class body alone).
|
|
215
|
+
*
|
|
216
|
+
* `file` is the name that source came from, and it is not decoration: the parser reads the dialect
|
|
217
|
+
* off the extension. A class with a `render()` lives in `agent.tsx` and its JSX is a syntax error
|
|
218
|
+
* as .ts, while a class that writes `<Slot>row` as a cast is a syntax error as .tsx — so the name
|
|
219
|
+
* of the file is the one thing that can tell the two apart, and it travels from whoever read it.
|
|
220
|
+
*/
|
|
221
|
+
export function parseClassSource(text, file = "agent.tsx") {
|
|
222
|
+
const docs = { methods: new Map() };
|
|
223
|
+
const parsed = parseSync(file, text, { sourceType: "module" });
|
|
224
|
+
const source = {
|
|
225
|
+
text,
|
|
226
|
+
jsdoc: parsed.comments.filter((one) => one.type === "Block" && one.value.startsWith("*")),
|
|
227
|
+
};
|
|
228
|
+
const body = parsed.program.body;
|
|
229
|
+
const found = theClass(body);
|
|
230
|
+
if (!found)
|
|
231
|
+
return docs;
|
|
232
|
+
const doc = docAt(found.start, source);
|
|
233
|
+
if (doc)
|
|
234
|
+
docs.doc = doc;
|
|
235
|
+
const types = declaredTypes(body);
|
|
236
|
+
for (const member of found.node.body.body) {
|
|
237
|
+
const method = member.type === "MethodDefinition" && (member.kind === "method" || member.kind === "get");
|
|
238
|
+
if (!method && member.type !== "PropertyDefinition")
|
|
239
|
+
continue;
|
|
240
|
+
if (member.key.type !== "Identifier")
|
|
241
|
+
continue;
|
|
242
|
+
const name = member.key.name;
|
|
243
|
+
if (docs.methods.has(name))
|
|
244
|
+
continue;
|
|
245
|
+
const entry = { params: paramsOf(member, source, types) };
|
|
246
|
+
const memberDoc = docAt(member.start, source);
|
|
247
|
+
if (memberDoc)
|
|
248
|
+
entry.doc = memberDoc;
|
|
249
|
+
docs.methods.set(name, entry);
|
|
250
|
+
}
|
|
251
|
+
return docs;
|
|
252
|
+
}
|
|
253
|
+
// Every describe() moves this on, so anything that cached a spec built from the scraped body knows
|
|
254
|
+
// it is looking at an older answer than the one the source can now give.
|
|
255
|
+
let version = 0;
|
|
256
|
+
/** How many times a class has been handed its own source; a cache invalidator, nothing more. */
|
|
257
|
+
export function docsVersion() {
|
|
258
|
+
return version;
|
|
259
|
+
}
|
|
260
|
+
/** Hand a class its own source, so its docstrings and parameter types are readable at runtime. */
|
|
261
|
+
export function describe(ctor, source, file) {
|
|
262
|
+
const docs = parseClassSource(source, file);
|
|
263
|
+
registered.set(ctor, docs);
|
|
264
|
+
version++;
|
|
265
|
+
return docs;
|
|
266
|
+
}
|
|
267
|
+
/** What this class documents about itself: what describe() was given, or its own body. */
|
|
268
|
+
export function docsOf(ctor) {
|
|
269
|
+
const given = registered.get(ctor);
|
|
270
|
+
if (given)
|
|
271
|
+
return given;
|
|
272
|
+
let own = scraped.get(ctor);
|
|
273
|
+
if (!own) {
|
|
274
|
+
own = parseClassSource(ctor.toString());
|
|
275
|
+
scraped.set(ctor, own);
|
|
276
|
+
}
|
|
277
|
+
return own;
|
|
278
|
+
}
|
|
279
|
+
/** The class docstring, read from its source or from an explicit `static doc`. */
|
|
280
|
+
export function classDoc(ctor) {
|
|
281
|
+
return docsOf(ctor).doc ?? ctor.doc;
|
|
282
|
+
}
|
|
283
|
+
/** A class and the classes it extends, most derived first, stopping before Function itself. */
|
|
284
|
+
function chain(ctor) {
|
|
285
|
+
const classes = [];
|
|
286
|
+
for (let current = ctor; typeof current === "function"; current = Object.getPrototypeOf(current)) {
|
|
287
|
+
if (current === Function.prototype)
|
|
288
|
+
break;
|
|
289
|
+
classes.push(current);
|
|
290
|
+
}
|
|
291
|
+
return classes;
|
|
292
|
+
}
|
|
293
|
+
/** The docstring of one method, looked up along the prototype chain. */
|
|
294
|
+
export function methodDoc(ctor, name) {
|
|
295
|
+
for (const current of chain(ctor)) {
|
|
296
|
+
const doc = docsOf(current).methods.get(name)?.doc;
|
|
297
|
+
if (doc)
|
|
298
|
+
return doc;
|
|
299
|
+
}
|
|
300
|
+
return undefined;
|
|
301
|
+
}
|
|
302
|
+
/** The parameters of one method, looked up along the prototype chain. */
|
|
303
|
+
export function methodParams(ctor, name) {
|
|
304
|
+
for (const current of chain(ctor)) {
|
|
305
|
+
const found = docsOf(current).methods.get(name);
|
|
306
|
+
if (found)
|
|
307
|
+
return found.params;
|
|
308
|
+
}
|
|
309
|
+
return [];
|
|
310
|
+
}
|
|
311
|
+
//# sourceMappingURL=docstrings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docstrings.js","sourceRoot":"","sources":["../../src/agent/docstrings.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAE1G,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AA8CvC,MAAM,UAAU,GAAG,IAAI,OAAO,EAAuB,CAAC;AACtD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAuB,CAAC;AAKnD,sFAAsF;AACtF,MAAM,UAAU,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,oBAAoB,EAAE,IAAI,EAAW,CAAC;AAQ3E,qFAAqF;AACrF,SAAS,OAAO,CAAC,KAAa;IAC5B,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACpC,IAAI,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACzD,sFAAsF;QACtF,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,MAAM;QAChC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IACD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7B,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5C,CAAC;AAED;;;;GAIG;AACH,SAAS,KAAK,CAAC,KAAa,EAAE,MAAc;IAC1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c,EAAE,IAAY;IACvD,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QAClC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAChD,IAAI,KAAK;YAAE,OAAO,KAAK,CAAC,MAAM,CAAC;IACjC,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** The three hooks: what happens when a call starts, when it ends, and when memory is written. */
|
|
2
|
+
import type { EventMeta } from "./accepts.js";
|
|
3
|
+
/** The call an agent is answering, as much of it as this seam needs to name. */
|
|
4
|
+
export interface Call {
|
|
5
|
+
id: string;
|
|
6
|
+
contact: string;
|
|
7
|
+
from?: string;
|
|
8
|
+
channel?: string;
|
|
9
|
+
}
|
|
10
|
+
/** One thing the agent decided to remember or to forget about this contact. */
|
|
11
|
+
export interface MemoryOp {
|
|
12
|
+
op: "remember" | "forget";
|
|
13
|
+
key: string;
|
|
14
|
+
value?: unknown;
|
|
15
|
+
}
|
|
16
|
+
/** The hooks an app may override. All four are no-ops until the app says otherwise. */
|
|
17
|
+
export interface Lifecycle {
|
|
18
|
+
onCall(call: Call): unknown;
|
|
19
|
+
onEnd(call: Call): unknown;
|
|
20
|
+
onMemory(ops: MemoryOp[], call: Call): unknown;
|
|
21
|
+
onEvent(name: string, data: Record<string, unknown>, meta: EventMeta): unknown;
|
|
22
|
+
}
|
|
23
|
+
export type HookName = keyof Lifecycle;
|
|
24
|
+
/**
|
|
25
|
+
* Run one hook with its writes authored by it. A hook is the one other place besides a tool where
|
|
26
|
+
* assigning state is legal — `onCall` restoring the last conversation is the reason it exists.
|
|
27
|
+
*/
|
|
28
|
+
export declare function runHook<K extends HookName>(agent: Lifecycle, hook: K, ...args: Parameters<Lifecycle[K]>): Promise<unknown>;
|
|
29
|
+
//# sourceMappingURL=lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/agent/lifecycle.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAGlG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,gFAAgF;AAChF,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,+EAA+E;AAC/E,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,UAAU,GAAG,QAAQ,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,uFAAuF;AACvF,MAAM,WAAW,SAAS;IACxB,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC;IAC5B,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC;IAC/C,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;CAChF;AAED,MAAM,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC;AAEvC;;;GAGG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,QAAQ,EACxC,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,CAAC,EACP,GAAG,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAChC,OAAO,CAAC,OAAO,CAAC,CAGlB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** The three hooks: what happens when a call starts, when it ends, and when memory is written. */
|
|
2
|
+
import { withAuthorAsync } from "./authors.js";
|
|
3
|
+
/**
|
|
4
|
+
* Run one hook with its writes authored by it. A hook is the one other place besides a tool where
|
|
5
|
+
* assigning state is legal — `onCall` restoring the last conversation is the reason it exists.
|
|
6
|
+
*/
|
|
7
|
+
export function runHook(agent, hook, ...args) {
|
|
8
|
+
const method = agent[hook];
|
|
9
|
+
return withAuthorAsync(`hook:${hook}`, () => method.apply(agent, args));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=lifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../src/agent/lifecycle.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAElG,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AA4B/C;;;GAGG;AACH,MAAM,UAAU,OAAO,CACrB,KAAgB,EAChB,IAAO,EACP,GAAG,IAA8B;IAEjC,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAoC,CAAC;IAC9D,OAAO,eAAe,CAAC,QAAQ,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** `stage`: the readable spelling of a tool that is only there while the state says so. */
|
|
2
|
+
import type { ToolOptions } from "./tools.js";
|
|
3
|
+
/**
|
|
4
|
+
* The stages an agent moves through, written once as the type of its own field:
|
|
5
|
+
* `stage: Stages<"identify" | "choose" | "book" | "done"> = "identify"`. It stays a plain state
|
|
6
|
+
* field — the alias is there so the class and every `@tool({ stage })` name the same four words.
|
|
7
|
+
*/
|
|
8
|
+
export type Stages<Named extends string> = Named;
|
|
9
|
+
/**
|
|
10
|
+
* The stage names a tool of this class may name: the union its `stage` field declares. A class
|
|
11
|
+
* without one gives `never`, so `@tool({ stage: "book" })` on it is a compile error and
|
|
12
|
+
* `@tool({ stage: "bok" })` on the clinic is another.
|
|
13
|
+
*/
|
|
14
|
+
export type StageOf<T> = T extends {
|
|
15
|
+
stage: infer Named extends string;
|
|
16
|
+
} ? Named : never;
|
|
17
|
+
/** The stages one declaration names, always as a list: `"book"` and `["choose", "book"]` read alike. */
|
|
18
|
+
export declare function stagesOf(options: {
|
|
19
|
+
stage?: unknown;
|
|
20
|
+
}): string[] | undefined;
|
|
21
|
+
/** The stage this agent is in right now, or undefined for a class that names no stages. */
|
|
22
|
+
export declare function stageOf(agent: object): string | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Lower `stage` to the one visibility there is, at declaration time. `when(state)` stays the only
|
|
25
|
+
* question ever asked of the state; a declaration that writes both is visible where both hold.
|
|
26
|
+
*/
|
|
27
|
+
export declare function lowerStage<T extends object>(options: ToolOptions<T>): ToolOptions<T>;
|
|
28
|
+
//# sourceMappingURL=stages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stages.d.ts","sourceRoot":"","sources":["../../src/agent/stages.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAG3F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;GAIG;AACH,MAAM,MAAM,MAAM,CAAC,KAAK,SAAS,MAAM,IAAI,KAAK,CAAC;AAEjD;;;;GAIG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,KAAK,EAAE,MAAM,KAAK,SAAS,MAAM,CAAA;CAAE,GAAG,KAAK,GAAG,KAAK,CAAC;AAEzF,wGAAwG;AACxG,wBAAgB,QAAQ,CAAC,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,EAAE,GAAG,SAAS,CAI3E;AAED,2FAA2F;AAC3F,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGzD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAYpF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** `stage`: the readable spelling of a tool that is only there while the state says so. */
|
|
2
|
+
/** The stages one declaration names, always as a list: `"book"` and `["choose", "book"]` read alike. */
|
|
3
|
+
export function stagesOf(options) {
|
|
4
|
+
const declared = options.stage;
|
|
5
|
+
if (declared === undefined)
|
|
6
|
+
return undefined;
|
|
7
|
+
return Array.isArray(declared) ? declared.map(String) : [String(declared)];
|
|
8
|
+
}
|
|
9
|
+
/** The stage this agent is in right now, or undefined for a class that names no stages. */
|
|
10
|
+
export function stageOf(agent) {
|
|
11
|
+
const named = agent.stage;
|
|
12
|
+
return typeof named === "string" ? named : undefined;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Lower `stage` to the one visibility there is, at declaration time. `when(state)` stays the only
|
|
16
|
+
* question ever asked of the state; a declaration that writes both is visible where both hold.
|
|
17
|
+
*/
|
|
18
|
+
export function lowerStage(options) {
|
|
19
|
+
const stages = stagesOf(options);
|
|
20
|
+
if (stages === undefined)
|
|
21
|
+
return options;
|
|
22
|
+
const also = options.when;
|
|
23
|
+
const inOneOfThem = (state) => {
|
|
24
|
+
const named = state.stage;
|
|
25
|
+
return typeof named === "string" && stages.includes(named);
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
...options,
|
|
29
|
+
when: also === undefined ? inOneOfThem : (state) => inOneOfThem(state) && also(state),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=stages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stages.js","sourceRoot":"","sources":["../../src/agent/stages.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAmB3F,wGAAwG;AACxG,MAAM,UAAU,QAAQ,CAAC,OAA4B;IACnD,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC;IAC/B,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC7C,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC7E,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,OAAO,CAAC,KAAa;IACnC,MAAM,KAAK,GAAI,KAA6B,CAAC,KAAK,CAAC;IACnD,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACvD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAmB,OAAuB;IAClE,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IACjC,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC;IACzC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1B,MAAM,WAAW,GAAG,CAAC,KAAkB,EAAW,EAAE;QAClD,MAAM,KAAK,GAAI,KAA6B,CAAC,KAAK,CAAC;QACnD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7D,CAAC,CAAC;IACF,OAAO;QACL,GAAG,OAAO;QACV,IAAI,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC;KACtF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** The state: what the agent remembers, read as a plain object, diffed, restored and collapsed. */
|
|
2
|
+
import { CONFIG_FIELDS, changes } from "./agent.js";
|
|
3
|
+
type ConfigName = (typeof CONFIG_FIELDS)[number];
|
|
4
|
+
type StateOf<T> = {
|
|
5
|
+
[K in keyof T as T[K] extends Function ? never : K extends ConfigName ? never : K]: T[K];
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* The agent's state as a plain object — no methods, no config, no framework keys. `Snapshot<T>`
|
|
9
|
+
* is that object for the class T, so `when: (s) => !s.identified` type-checks; bare `Snapshot` is
|
|
10
|
+
* the erased one the framework itself passes around.
|
|
11
|
+
*/
|
|
12
|
+
export type Snapshot<T = unknown> = unknown extends T ? Record<string, unknown> : StateOf<T>;
|
|
13
|
+
/** One field that differs between two snapshots. */
|
|
14
|
+
export interface FieldDiff {
|
|
15
|
+
field: string;
|
|
16
|
+
prev: unknown;
|
|
17
|
+
next: unknown;
|
|
18
|
+
}
|
|
19
|
+
/** Everything the agent remembers right now, copied out so a reader cannot write through it. */
|
|
20
|
+
export declare function snapshot(agent: object): Snapshot;
|
|
21
|
+
/** What changed between two snapshots, in the order the later one lists its fields. */
|
|
22
|
+
export declare function diff(before: Snapshot, after: Snapshot): FieldDiff[];
|
|
23
|
+
/**
|
|
24
|
+
* Put the agent back to a snapshot. This is a write like any other, so it needs an author: the
|
|
25
|
+
* caller's, when one is running, and `restore` when nothing is.
|
|
26
|
+
*/
|
|
27
|
+
export declare function restore(agent: object, state: Snapshot): void;
|
|
28
|
+
/** A collapsed history: one sentence standing in for every change that came before it. */
|
|
29
|
+
export interface Collapsed {
|
|
30
|
+
summary: string;
|
|
31
|
+
seq: number;
|
|
32
|
+
at: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Drop the change log and keep one sentence in its place. The state itself is untouched — what
|
|
36
|
+
* collapses is the memory of how it got here, which is what a long call runs out of room for.
|
|
37
|
+
*/
|
|
38
|
+
export declare function collapse(agent: object, summary: string): Collapsed;
|
|
39
|
+
/** What the agent last knew about this contact, when a store is wired in. */
|
|
40
|
+
export type LastCall = (contact: string) => Promise<Snapshot | null>;
|
|
41
|
+
/** The change log, re-exported here because the log and the state are read together. */
|
|
42
|
+
export { changes };
|
|
43
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/agent/state.ts"],"names":[],"mappings":"AAAA,mGAAmG;AAEnG,OAAO,EAAS,aAAa,EAAE,OAAO,EAA8B,MAAM,YAAY,CAAC;AAMvF,KAAK,UAAU,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAKjD,KAAK,OAAO,CAAC,CAAC,IAAI;KACf,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,QAAQ,GAAG,KAAK,GAAG,CAAC,SAAS,UAAU,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACzF,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,OAAO,IAAI,OAAO,SAAS,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAE7F,oDAAoD;AACpD,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;CACf;AAiCD,gGAAgG;AAChG,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAYhD;AAED,uFAAuF;AACvF,wBAAgB,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,GAAG,SAAS,EAAE,CASnE;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI,CAkB5D;AAED,0FAA0F;AAC1F,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAalE;AAED,6EAA6E;AAC7E,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;AAErE,wFAAwF;AACxF,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/** The state: what the agent remembers, read as a plain object, diffed, restored and collapsed. */
|
|
2
|
+
import { Agent, CONFIG_FIELDS, changes, internalsOf, isConfigField } from "./agent.js";
|
|
3
|
+
import { currentAuthor, withAuthor } from "./authors.js";
|
|
4
|
+
import { declaredStateOf } from "./visibility.js";
|
|
5
|
+
// The state is whatever the app put on the instance: own, enumerable, not a method, not one of the
|
|
6
|
+
// config names — and, when the class decorated any field with `@state`, one of the fields it named.
|
|
7
|
+
// A class that decorated none declares nothing twice, as it always did.
|
|
8
|
+
function isStateField(key, value, declared) {
|
|
9
|
+
if (isConfigField(key) || typeof value === "function")
|
|
10
|
+
return false;
|
|
11
|
+
return declared === null || declared.has(key);
|
|
12
|
+
}
|
|
13
|
+
/** The fields this instance's class said are its state, or null when it said nothing. */
|
|
14
|
+
function stateOf(agent) {
|
|
15
|
+
return declaredStateOf(internalsOf(agent).target.constructor);
|
|
16
|
+
}
|
|
17
|
+
// A getter is state too — `get identified() { return !!this.patient }` is exactly what a `when`
|
|
18
|
+
// asks about — so the snapshot reads the prototype chain as well as the instance, stopping at
|
|
19
|
+
// Agent so the framework's own accessors never leak into the tenant's state.
|
|
20
|
+
function gettersOf(agent) {
|
|
21
|
+
const names = [];
|
|
22
|
+
for (let prototype = Object.getPrototypeOf(agent); prototype && prototype !== Object.prototype; prototype = Object.getPrototypeOf(prototype)) {
|
|
23
|
+
if (prototype.constructor === Agent)
|
|
24
|
+
break;
|
|
25
|
+
for (const [name, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(prototype))) {
|
|
26
|
+
if (typeof descriptor.get === "function" && !names.includes(name))
|
|
27
|
+
names.push(name);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return names;
|
|
31
|
+
}
|
|
32
|
+
/** Everything the agent remembers right now, copied out so a reader cannot write through it. */
|
|
33
|
+
export function snapshot(agent) {
|
|
34
|
+
const own = internalsOf(agent);
|
|
35
|
+
const readable = agent;
|
|
36
|
+
const declared = stateOf(agent);
|
|
37
|
+
const state = {};
|
|
38
|
+
for (const key of Object.keys(own.target)) {
|
|
39
|
+
const value = own.target[key];
|
|
40
|
+
if (isStateField(key, value, declared))
|
|
41
|
+
state[key] = value;
|
|
42
|
+
}
|
|
43
|
+
// Read the getters through the agent itself: they are written against `this`, not against target.
|
|
44
|
+
for (const name of gettersOf(agent))
|
|
45
|
+
state[name] = readable[name];
|
|
46
|
+
return state;
|
|
47
|
+
}
|
|
48
|
+
/** What changed between two snapshots, in the order the later one lists its fields. */
|
|
49
|
+
export function diff(before, after) {
|
|
50
|
+
const fields = new Set([...Object.keys(before), ...Object.keys(after)]);
|
|
51
|
+
const changed = [];
|
|
52
|
+
for (const field of fields) {
|
|
53
|
+
if (!Object.is(before[field], after[field])) {
|
|
54
|
+
changed.push({ field, prev: before[field], next: after[field] });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return changed;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Put the agent back to a snapshot. This is a write like any other, so it needs an author: the
|
|
61
|
+
* caller's, when one is running, and `restore` when nothing is.
|
|
62
|
+
*/
|
|
63
|
+
export function restore(agent, state) {
|
|
64
|
+
const author = currentAuthor() ?? "restore";
|
|
65
|
+
const derived = new Set(gettersOf(agent));
|
|
66
|
+
const declared = stateOf(agent);
|
|
67
|
+
const target = internalsOf(agent).target;
|
|
68
|
+
withAuthor(author, () => {
|
|
69
|
+
const writable = agent;
|
|
70
|
+
const fields = new Set(Object.keys(target));
|
|
71
|
+
// A whole state goes in, so a field the snapshot leaves out is emptied — but only if it is
|
|
72
|
+
// state at all: a scratch field is nobody's business here.
|
|
73
|
+
for (const key of fields) {
|
|
74
|
+
if (isStateField(key, target[key], declared) && !(key in state))
|
|
75
|
+
writable[key] = undefined;
|
|
76
|
+
}
|
|
77
|
+
// Getters are derived, so a snapshot restores the fields they are derived from and no more.
|
|
78
|
+
for (const [key, value] of Object.entries(state)) {
|
|
79
|
+
if (fields.has(key) || !derived.has(key))
|
|
80
|
+
writable[key] = value;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Drop the change log and keep one sentence in its place. The state itself is untouched — what
|
|
86
|
+
* collapses is the memory of how it got here, which is what a long call runs out of room for.
|
|
87
|
+
*/
|
|
88
|
+
export function collapse(agent, summary) {
|
|
89
|
+
const own = internalsOf(agent);
|
|
90
|
+
const collapsed = { summary, seq: ++own.seq, at: Date.now() };
|
|
91
|
+
own.changes.length = 0;
|
|
92
|
+
own.changes.push({
|
|
93
|
+
seq: collapsed.seq,
|
|
94
|
+
field: "@summary",
|
|
95
|
+
prev: undefined,
|
|
96
|
+
next: summary,
|
|
97
|
+
author: "collapse",
|
|
98
|
+
at: collapsed.at,
|
|
99
|
+
});
|
|
100
|
+
return collapsed;
|
|
101
|
+
}
|
|
102
|
+
/** The change log, re-exported here because the log and the state are read together. */
|
|
103
|
+
export { changes };
|
|
104
|
+
//# sourceMappingURL=state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/agent/state.ts"],"names":[],"mappings":"AAAA,mGAAmG;AAEnG,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,eAA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