@segmentstream/agent 0.47.0 → 0.50.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.
Files changed (93) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/README.md +14 -15
  3. package/dist/_chunks/{build-metadata-5S6uTvyu.mjs → build-metadata-DrQtDIMX.mjs} +1 -1
  4. package/dist/_chunks/principal-D5Tualrk.mjs +1836 -0
  5. package/dist/extension/channels/slack.mjs +2 -1
  6. package/dist/extension/channels/whatsapp.mjs +1 -0
  7. package/dist/extension/connections/ontology.mjs +1 -1
  8. package/dist/extension/hooks/authorization.mjs +1 -1
  9. package/dist/extension/instructions/persona.mjs +1 -1
  10. package/dist/extension/lib/actor.mjs +1 -46
  11. package/dist/extension/lib/attachment-tools.mjs +1 -3
  12. package/dist/extension/lib/attachments.d.ts +1 -1
  13. package/dist/extension/lib/attachments.mjs +1 -230
  14. package/dist/extension/lib/build-metadata.mjs +1 -1
  15. package/dist/extension/lib/chat-address.mjs +1 -50
  16. package/dist/extension/lib/chat-context.mjs +1 -1
  17. package/dist/extension/lib/chat-recorder.mjs +1 -2
  18. package/dist/extension/lib/confirmations.mjs +1 -179
  19. package/dist/extension/lib/inbound-media/files.d.ts +91 -0
  20. package/dist/extension/lib/inbound-media/files.mjs +7 -0
  21. package/dist/extension/lib/{telegram → inbound-media}/images.d.ts +2 -0
  22. package/dist/extension/lib/{telegram → inbound-media}/images.mjs +1 -2
  23. package/dist/extension/lib/inbound-media/index.d.ts +55 -0
  24. package/dist/extension/lib/inbound-media/index.mjs +7 -0
  25. package/dist/extension/lib/inbound-media/plan.d.ts +59 -0
  26. package/dist/extension/lib/{telegram/media-policy.mjs → inbound-media/plan.mjs} +56 -4
  27. package/dist/extension/lib/inbound-media/report.d.ts +5 -0
  28. package/dist/extension/lib/inbound-media/report.mjs +7 -0
  29. package/dist/extension/lib/inbound-media/speech.d.ts +52 -0
  30. package/dist/extension/lib/inbound-media/speech.mjs +73 -0
  31. package/dist/extension/lib/ontology-connection.mjs +1 -101
  32. package/dist/extension/lib/ontology-file-call.mjs +1 -4
  33. package/dist/extension/lib/ontology-tools.mjs +1 -377
  34. package/dist/extension/lib/review/hold.mjs +1 -2
  35. package/dist/extension/lib/review/reply.mjs +1 -2
  36. package/dist/extension/lib/role-skill.mjs +1 -1
  37. package/dist/extension/lib/runtime-envelope.mjs +1 -1
  38. package/dist/extension/lib/sent-files.mjs +1 -2
  39. package/dist/extension/lib/slack/adapter.d.ts +49 -7
  40. package/dist/extension/lib/slack/adapter.mjs +79 -21
  41. package/dist/extension/lib/slack/attachments-send.mjs +1 -3
  42. package/dist/extension/lib/slack/files.d.ts +12 -19
  43. package/dist/extension/lib/slack/files.mjs +26 -58
  44. package/dist/extension/lib/stored-files.mjs +1 -3
  45. package/dist/extension/lib/telegram/adapter.d.ts +3 -3
  46. package/dist/extension/lib/telegram/adapter.mjs +13 -17
  47. package/dist/extension/lib/telegram/attachment-description.d.ts +1 -1
  48. package/dist/extension/lib/telegram/attachment-description.mjs +2 -2
  49. package/dist/extension/lib/telegram/attachments-send.mjs +1 -3
  50. package/dist/extension/lib/telegram/callbacks.mjs +1 -2
  51. package/dist/extension/lib/telegram/chat-archive.mjs +1 -1
  52. package/dist/extension/lib/telegram/confirmations.mjs +1 -3
  53. package/dist/extension/lib/telegram/customer-text.mjs +1 -1
  54. package/dist/extension/lib/telegram/files.d.ts +8 -15
  55. package/dist/extension/lib/telegram/files.mjs +32 -107
  56. package/dist/extension/lib/telegram/health.mjs +1 -1
  57. package/dist/extension/lib/telegram/held-approvals.mjs +1 -1
  58. package/dist/extension/lib/telegram/inbound-request.d.ts +6 -12
  59. package/dist/extension/lib/telegram/inbound-request.mjs +1 -1
  60. package/dist/extension/lib/telegram/inbound.d.ts +3 -3
  61. package/dist/extension/lib/telegram/inbound.mjs +11 -11
  62. package/dist/extension/lib/telegram/lifecycle.mjs +2 -6
  63. package/dist/extension/lib/telegram/principal.mjs +1 -1
  64. package/dist/extension/lib/telegram/session-recovery.mjs +1 -1
  65. package/dist/extension/lib/telegram/silent.mjs +1 -1
  66. package/dist/extension/lib/telegram/structured.mjs +1 -1
  67. package/dist/extension/lib/telegram/turn-errors.mjs +1 -2
  68. package/dist/extension/lib/telegram/voice.d.ts +7 -38
  69. package/dist/extension/lib/telegram/voice.mjs +1 -64
  70. package/dist/extension/lib/telegram/workspace-action.mjs +1 -3
  71. package/dist/extension/lib/web/auth.d.ts +27 -4
  72. package/dist/extension/lib/web/auth.mjs +1 -124
  73. package/dist/extension/lib/web/channel.d.ts +13 -4
  74. package/dist/extension/lib/web/channel.mjs +15 -8
  75. package/dist/extension/lib/whatsapp/adapter.d.ts +37 -1
  76. package/dist/extension/lib/whatsapp/adapter.mjs +118 -21
  77. package/dist/extension/lib/whatsapp/files.d.ts +40 -0
  78. package/dist/extension/lib/whatsapp/files.mjs +70 -0
  79. package/dist/extension/lib/workspace-source.mjs +1 -3
  80. package/dist/extension/model.mjs +1 -1
  81. package/dist/extension/tools/attachments_discard.mjs +1 -1
  82. package/dist/extension/tools/attachments_list.mjs +1 -1
  83. package/dist/extension/tools/attachments_promote.mjs +1 -5
  84. package/dist/extension/tools/attachments_read.mjs +1 -1
  85. package/dist/extension/tools/attachments_send.mjs +1 -2
  86. package/dist/extension/tools/attachments_stage.mjs +1 -1
  87. package/dist/extension/tools/attachments_table.mjs +1 -1
  88. package/dist/extension/tools/questions_ask.mjs +1 -2
  89. package/dist/extension/tools/workspace_source.mjs +1 -1
  90. package/package.json +2 -2
  91. package/dist/_chunks/inbound-request-B3RhCuOw.mjs +0 -413
  92. package/dist/_chunks/principal-Dzs8hUDB.mjs +0 -128
  93. package/dist/extension/lib/telegram/media-policy.d.ts +0 -15
package/CHANGELOG.md CHANGED
@@ -1,5 +1,80 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.50.0
4
+
5
+ The agent answers a website's visitors. `signUp` takes the channel `web` with `origins`, the
6
+ websites by exact origin: a browser on one of them signs its visitor up at
7
+ `POST /api/ontology/agent/visitors`, which creates a user holding the roles `signUp` gives `web`
8
+ and answers an agent token with a refresh token. The refresh token renews the agent token at the
9
+ ontology's OAuth token endpoint as client `agent-web`, which the service serves for visitors even
10
+ with `mcp: false`. A visitor's `onSignUp` that fails runs again before their next turn, as it does
11
+ on a messenger, and so does that of anyone sign-up created who talks to the agent from the app. Any other origin is refused with
12
+ `origin_not_allowed`; one network address may start 10 visitors an hour, and the workspace's cap on
13
+ new users and the agent's turn limits apply as to everyone `signUp` created. `check` refuses `web`
14
+ without origins, and an origin with a path, a wildcard, or `http` beyond `localhost`.
15
+
16
+ The agent's web channel answers browsers on any origin, since every request carries an agent token
17
+ as its bearer, never a cookie.
18
+
19
+ `useAgent({ app })` in `@segmentstream/app/agent` talks to the agent of the workspace app at `app`
20
+ from another website, as its visitor: it signs them up with their first message and keeps their
21
+ refresh token in the browser, so they stay the same user. `visitorToken(app)` gets the token
22
+ outside React and `forgetVisitorTokens()` starts over as a new visitor.
23
+
24
+ Pins @segmentstream/ontology 0.104.0.
25
+
26
+ ## 0.49.0
27
+
28
+ Voice messages, files and images work the same in Telegram, Slack and WhatsApp.
29
+
30
+ - One inbound media pipeline serves every channel. A voice message, audio file or video note
31
+ (Telegram's, a clip recorded in Slack, a WhatsApp voice note or audio) is transcribed with
32
+ `models.stt` before the session sees it: the transcript is the message's text, after its
33
+ caption, and a note such as `[voice message, 12 s]` says it was spoken. Before, Slack handed
34
+ the model the audio file untranscribed, and WhatsApp only the text `[Audio message]`, so the
35
+ agent answered that it could not hear it. `models.stt: false` turns voice off in every channel.
36
+ - A file a member sends in WhatsApp is stored before the turn, as in Telegram and Slack, as the
37
+ member's 24-hour attachment in `whatsapp:<thread id>` and named in the `<attachments>` block,
38
+ so `attachments_read`, `attachments_table`, `attachments_promote` and `attachments_discard`
39
+ work on it. In Slack and WhatsApp eve still hands the model images and documents, downloading
40
+ them through the connection when the turn starts; a spoken file reaches it only as its
41
+ transcript.
42
+ - In Slack and WhatsApp, as in Telegram, an image the turn's chat model does not read natively
43
+ reaches it as a `models.imageDescription` description. In Slack and Telegram the model is the
44
+ one the thread's session runs on, whoever writes now.
45
+ - A file that cannot be stored reads the same in every channel:
46
+ `not received, it is 50.0 MB, over the 20.0 MB the agent accepts`, or
47
+ `not received, it could not be stored; error reference: …`. Telegram's note used the
48
+ workspace's attachment failure text, and Slack's ended in `(reference …)`.
49
+ - WhatsApp shows the typing indicator while the agent works, on the member's latest message, as
50
+ the turn starts and on each tool call. Before, the turn ran where the WhatsApp adapter had no
51
+ record of the message, and the indicator never showed. A refused indicator never stops the
52
+ turn.
53
+
54
+ Action required: upgrade `@segmentstream/ontology` with this release. An older ontology refuses
55
+ `whatsapp` as an attachment source, and a WhatsApp file then reaches the turn named as not stored.
56
+
57
+ Pins @segmentstream/ontology 0.103.0.
58
+
59
+ ## 0.48.0
60
+
61
+ The agent's limits for people who signed up now apply to the web. Each message a member sends from
62
+ the browser starts a turn that the ontology counts against `limits` when `signUp` created them, by
63
+ email too, on the same counters as their turns on a messenger. Invited and paired members are never
64
+ counted. A turn beyond the limits is refused before it reaches the model with `429 rate_limited` and
65
+ `Retry-After`, and `useAgent()` reports it, like every refusal of the agent's routes, as a
66
+ `SegmentStreamApiError` with its code. The counts use the `limits` the agent last sent with a
67
+ messenger's turn, or the platform's defaults.
68
+
69
+ The agent token introspection (`POST /api/ontology/agent/tokens/introspect`) accepts `turn: true`
70
+ and then answers `limited: { scope, retry_after_seconds }` for a turn beyond the limits.
71
+
72
+ Action required: upgrade the ontology SDK together with the agent SDK. With an ontology SDK released
73
+ before this one, the agent asks again without the turn and web turns stay uncounted until
74
+ 2027-02-15; after that date they fail.
75
+
76
+ Pins @segmentstream/ontology 0.102.0.
77
+
3
78
  ## 0.47.0
4
79
 
5
80
  A member signed in to the workspace app can talk to the agent from the browser, as themselves and
package/README.md CHANGED
@@ -7,6 +7,9 @@ calls go through the workspace's connection, unknown senders pair with a member
7
7
  messages become text, and group chats are answered only when the agent is addressed or asked for
8
8
  something it does.
9
9
 
10
+ Guides named by path below, such as `docs/ontology.md`, are in every workspace project;
11
+ `segmentstream sync` keeps them current.
12
+
10
13
  The package is built against one eve version, `1.0.1`, and the workspace's `agent/` pins the
11
14
  same one. eve and the package move together.
12
15
 
@@ -149,7 +152,7 @@ text is missing. Guidance for the group decision model lives the same way in
149
152
  Skills stay eve's, in `agent/agent/skills/`. A module there that exports
150
153
  `forRoles(["accountant", "founder"], { description, content })` is a skill only those roles get:
151
154
  it is an eve dynamic skill, listed and loadable only in sessions started by a person holding one
152
- of the roles. See [personas and skills by role](../../docs/agent.md#personas-and-skills-by-role)
155
+ of the roles. See personas and skills by role (`docs/agent.md#personas-and-skills-by-role`)
153
156
  in the workspace agent guide.
154
157
 
155
158
  ## Reply review
@@ -160,7 +163,7 @@ Telegram and WhatsApp: `{ "review": { "mode": "never" } }` (the agent, the defau
160
163
  `{ "mode": "whenUnsure", "minConfidence": 0.9 }` (the decision model judges each reply in its
161
164
  chat, with the criteria in `agent/review/<role>.md`, and the agent sends those it is sure
162
165
  enough of). A held reply becomes an `agent_review` record of the ontology, which a member
163
- approves, edits or rejects. See [reply review](../../docs/agent.md#reply-review) in the workspace
166
+ approves, edits or rejects. See reply review (`docs/agent.md#reply-review`) in the workspace
164
167
  agent guide.
165
168
 
166
169
  ## Channel admission and first contact
@@ -321,9 +324,8 @@ SHA-256. No URL, header or credential enters the sandbox. `segmentstream__read_f
321
324
  so PNG, JPEG, GIF and WebP images up to 3 MiB and PDFs up to 20 MiB reach the model as files.
322
325
 
323
326
  `segmentstream__workspace_source`, offered to members with `"workspaceSource": true`, copies the
324
- commit production runs into `/workspace/source` for a member who holds `workspace_source:read`
325
- (see `docs/workspace-source-spec.md`). The runtime reads `/api/ontology/agent/source` page by page
326
- as the member with its own token, refuses pages that name different commits (starting once more
327
+ commit production runs into `/workspace/source` for a member who holds `workspace_source:read`.
328
+ The runtime reads `/api/ontology/agent/source` page by page as the member with its own token, refuses pages that name different commits (starting once more
327
329
  when production moves meanwhile) and archives with entries other than files and directories or
328
330
  paths outside their root, extracts them into `/workspace/source.tmp`, swaps that in read-only and
329
331
  writes `/workspace/.segmentstream/source.json` with the member, the commit, the turn and the counts.
@@ -381,7 +383,7 @@ client with a member, and it negotiates neither chat posting nor the chat's runt
381
383
 
382
384
  A workflow hands the workspace's agent a prompt with `agentTask` from
383
385
  `@segmentstream/ontology/workflows` and waits for its answer
384
- ([the specification](../../docs/agent-tasks-spec.md)). The task runs in an ordinary session of the
386
+ (see `docs/ontology.md#agent-tasks`). The task runs in an ordinary session of the
385
387
  same agent: its instructions, model choice from the principal's roles, tools, guides and sandbox.
386
388
  The SDK adds no text to the prompt.
387
389
 
@@ -457,7 +459,7 @@ The SDK adds no text to the prompt.
457
459
  steers their running turn, and other members' messages queue behind it. Turn cancellations use
458
460
  `texts.notice.cancelled` with a symbol fallback; an unconfigured failure notice never consists
459
461
  only of a reference. Diagnostics remain in operator logs.
460
- See [group configuration](../../docs/agent.md#groups).
462
+ See group configuration (`docs/agent.md#groups`).
461
463
  - **Voice.** Voice messages, audio files and video notes are downloaded through the connection and
462
464
  transcribed with `models.stt` through AI Gateway before the turn.
463
465
  The transcript becomes the message, with a note such as `[voice message, 12 s]` in
@@ -744,9 +746,7 @@ Archive metadata and message text retain the workspace policy (365 days by defau
744
746
  Platform REST reads, the workspace ontology's
745
747
  `chat_history` and `chat_search`, and the member REST facade enforce workspace/group
746
748
  permissions and DM participant/admin scope. Deploy the backend migration/API and upgrade the
747
- ontology SDK along with this extension. See the repository's
748
- [chat storage guide](../../docs/agent-chat-storage.md) for APIs, retention,
749
- eve's existing storage, and Telegram's delivery limits.
749
+ ontology SDK along with this extension.
750
750
 
751
751
  ### Exact chat posting protocol
752
752
 
@@ -801,7 +801,7 @@ An older archive returning only `{stored:true}` cannot authorize a send.
801
801
  Rollback
802
802
  disables posting while preserving archive claims and deduplication tombstones;
803
803
  it never restores relay or retries uncertain deliveries.
804
- See [migration and verification](../../docs/agent-chat-delivery-migration.md).
804
+ See migration and verification (`docs/agent-chat-delivery-migration.md`).
805
805
 
806
806
  ### Deleted session deployments
807
807
 
@@ -841,7 +841,6 @@ The first insert also emits `[segmentstream] model service alert` in runtime log
841
841
  Per-turn diagnostics remain available; alerting failures do not replace the original
842
842
  error. Read alerts with `segmentstream agent logs --query model_service_alert --all`.
843
843
  This does not submit member feedback or send an operator chat message.
844
- See [the incident and verification procedure](../../docs/telegram-session-recovery.md).
845
844
 
846
845
  ### Opt-in attachment lifecycle
847
846
 
@@ -949,10 +948,10 @@ data schemas; workspaces opt in only after their hook accepts the additional fie
949
948
  Runtime health reports native approvals and attachment-lifecycle presence behind its existing
950
949
  runtime authentication; source pins and public health alone are not adoption proof.
951
950
 
952
- Telegram 0.13.0 requires workspace-authored pairing and confirmation text. See [workspace Telegram text](../../docs/agent.md#workspace-telegram-text) for keys, limits, neutral fallbacks and unsupported Eve buttons.
951
+ Telegram 0.13.0 requires workspace-authored pairing and confirmation text. See workspace Telegram text (`docs/agent.md#workspace-telegram-text`) for keys, limits, neutral fallbacks and unsupported Eve buttons.
953
952
 
954
- Workspace [callback actions](../../docs/agent.md#workspace-callback-actions) and
955
- [structured Telegram input](../../docs/agent.md#structured-telegram-input) are separate opt-in
953
+ Workspace callback actions (`docs/agent.md#workspace-callback-actions`) and
954
+ structured Telegram input (`docs/agent.md#structured-telegram-input`) are separate opt-in
956
955
  mappings. They require the ontology runtime-source capability and dispatch only a currently
957
956
  permitted routine action as the verified member. The workspace owns callback tokens, presentation
958
957
  and business idempotency.
@@ -4,7 +4,7 @@ import { createRequire as __eveCreateRequire } from "node:module";
4
4
  const __filename = __eveFileURLToPath(import.meta.url);
5
5
  __eveDirname(__filename);
6
6
  __eveCreateRequire(import.meta.url);
7
- var version = "0.47.0";
7
+ var version = "0.50.0";
8
8
  function agentBuild(environment = process.env) {
9
9
  return {
10
10
  agent: version,