@elevasis/sdk 1.43.0 → 1.44.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elevasis/sdk",
3
- "version": "1.43.0",
3
+ "version": "1.44.1",
4
4
  "description": "SDK for building Elevasis organization resources",
5
5
  "type": "module",
6
6
  "bin": {
@@ -58,9 +58,9 @@
58
58
  "tsup": "^8.0.0",
59
59
  "typescript": "5.9.2",
60
60
  "zod": "^4.1.0",
61
- "@repo/core": "0.58.0",
62
- "@repo/typescript-config": "0.0.0",
63
- "@repo/eslint-config": "0.0.0"
61
+ "@repo/core": "0.59.0",
62
+ "@repo/eslint-config": "0.0.0",
63
+ "@repo/typescript-config": "0.0.0"
64
64
  },
65
65
  "scripts": {
66
66
  "lint": "eslint src --max-warnings 0",
@@ -0,0 +1,122 @@
1
+ # Your auth guards now wait for organization context, and truncated tool results stay valid JSON
2
+
3
+ ## Why this note exists
4
+
5
+ This train publishes all three packages at once — `@elevasis/core`, `@elevasis/ui`, and
6
+ `@elevasis/sdk`. Four of the changes are things you can observe without changing a line of your own
7
+ code, which is exactly why they are worth reading before you take the baseline bump.
8
+
9
+ **1. `ProtectedRoute` now waits for organization context by default.** This is the one behavior
10
+ change most likely to surprise you, because nothing in your project asked for it.
11
+
12
+ Until now the default value of `waitForOrganization` depended on which import path a route file
13
+ happened to use. Routes importing the guard from `@elevasis/ui/features/auth` defaulted to `false`
14
+ and rendered before organization context existed; routes importing from `@elevasis/ui/auth`
15
+ defaulted to `true` and waited. One application, two guard behaviors, decided by an import
16
+ specifier. Both defaults are now `true`, resolved through a single shared predicate.
17
+
18
+ We audited every template-family project before shipping this rather than assuming it was safe.
19
+ Between 8 and 9 routes per project are affected — `index.tsx`, `knowledge.tsx`, and every
20
+ `settings/*.tsx` — and **not one route in any project passes the prop explicitly**. Every affected
21
+ route is organization-scoped, so none of them has a legitimate reason to render before organization
22
+ context arrives. The measurable cost is that `settings/appearance.tsx` and `settings/account.tsx`
23
+ are user-scoped and will now wait marginally longer than they strictly need to. That is latency, not
24
+ breakage.
25
+
26
+ If you have a route that genuinely must render before organization context exists, pass
27
+ `waitForOrganization={false}` explicitly. Relying on the old default is no longer possible.
28
+
29
+ **2. Invited members who have not signed up yet are now visibly distinguished.** A previous train
30
+ made them _appear_ in your members list, which fixed wrong counts. It did not make them
31
+ _identifiable_ — the type shipped but the renderer did not, so every member looked equally
32
+ provisioned. `ProvisioningStateBadge` now ships inside `@elevasis/ui` and `OrgMembersList` renders it
33
+ beside the existing status badge, in the same cell rather than a new column. A fully-provisioned
34
+ member renders nothing, so nothing about your existing rows changes.
35
+
36
+ **3. Membership responses carry an explicit `workosMembershipId`, and `membership.id` is the platform
37
+ UUID.** The API used to be inconsistent about which identifier a membership response carried. It is
38
+ now uniform: `id` is always the platform's own UUID, and the WorkOS identifier has its own named
39
+ field. Both forms are accepted on lookup, so a request built either way still resolves.
40
+
41
+ **`organization.workos_org_id` is unchanged and still carries the WorkOS `org_…` value verbatim.**
42
+ That is the field your project selects organizations on and drives `switchToOrganization` with. It
43
+ was audited specifically because this change was in the same area; nothing about it moved.
44
+
45
+ **4. Four invitation API routes were removed** — `POST /api/invitations/accept`, and the
46
+ `GET /api/invitations`, `GET /api/invitations/:id`, `GET /api/invitations/summary` trio. All four
47
+ were dead surface with no caller in any project we could find. If you have an out-of-tree script
48
+ calling one, it will now 404.
49
+
50
+ **5. `@elevasis/sdk` fixes a JSON-safety defect in truncated tool results.** When a long tool result
51
+ was truncated, a cut landing between a key's closing quote and its colon left behind a key with no
52
+ value — `{"alpha":"…","nested"}` — which is not parseable JSON. Your agents read slightly malformed
53
+ JSON rather than crashing, because the parser falls back to the raw string, so the practical impact
54
+ was low. It is fixed regardless. The window was a few characters per key, which is why casual testing
55
+ never surfaced it.
56
+
57
+ ## Applies to
58
+
59
+ - **Every template-family project**, for items 1 through 3. All are consumed through the published
60
+ packages with no source edits on your side.
61
+ - **Any project whose settings page renders `OrgMembersList`** — that is the published component,
62
+ so the badge arrives with the `@elevasis/ui` bump.
63
+ - **Every project running agents**, for item 5. The truncation fix lives in the worker runtime that
64
+ `operations/` bundles, so it reaches you through `@elevasis/sdk`.
65
+ - **Not applicable to your organization model, knowledge nodes, or workflow definitions.** Nothing in
66
+ this train touches authored content.
67
+
68
+ ## Required actions
69
+
70
+ 1. **Take the `@elevasis/core`, `@elevasis/ui`, and `@elevasis/sdk` baseline bumps** this train
71
+ propagates, then reinstall in `core/`, `ui/`, and `operations/`.
72
+
73
+ 2. **Clear the Vite cache and restart your dev server.** A stale `.vite` cache serves the old bundle
74
+ while every gate reports green — that is the specific way this failure hides:
75
+
76
+ ```bash
77
+ rm -rf ui/node_modules/.vite
78
+ pnpm -C ui dev
79
+ ```
80
+
81
+ 3. **Redeploy `operations/` to pick up the truncation fix.** The baseline bump changes what your
82
+ next bundle contains; it does not change what is already deployed:
83
+
84
+ ```bash
85
+ pnpm -C operations exec elevasis-sdk deploy
86
+ ```
87
+
88
+ 4. **Check any route that must render before organization context exists.** If you have one, add
89
+ `waitForOrganization={false}` explicitly. If you are unsure whether you have one, the audit result
90
+ above says you almost certainly do not — every affected route in every project is
91
+ organization-scoped already.
92
+
93
+ ## Verification
94
+
95
+ - **Sign in and land on your home route.** This is the check that matters most, because the guard
96
+ default changed on the route that greets you. Confirm it renders, and that navigating to
97
+ `settings/appearance` and `settings/account` still works — those are the two user-scoped pages that
98
+ now wait for organization context they do not strictly need.
99
+ - **Open your settings members page.** Any member you have invited who has not completed signup
100
+ should now carry a visible badge; fully-provisioned members should look exactly as before.
101
+ - **Read the installed bundle, not the version number.** A bumped pin and a green sync report are
102
+ claims about intent; the installed file is the only ground truth:
103
+
104
+ ```bash
105
+ grep -rl "ProvisioningStateBadge" ui/node_modules/@elevasis/ui/dist/components/
106
+ grep -c "innermostIsObject" operations/node_modules/@elevasis/sdk/dist/worker/index.js
107
+ ```
108
+
109
+ No match on the first, or `0` on the second, means the install did not land regardless of what
110
+ `package.json` says.
111
+
112
+ ## Not handled by /git-sync
113
+
114
+ - **The Vite cache clear and dev-server restart.** `/git-sync` propagates and commits the dependency
115
+ baseline. Your running dev server keeps serving the previously cached bundle until you do step 2
116
+ yourself, and it will look like the sync did nothing.
117
+ - **The `operations/` redeploy.** Bumping the `@elevasis/sdk` pin changes what your next bundle
118
+ contains. Your currently deployed workers keep running the old bundle until you deploy.
119
+ - **Adding `waitForOrganization={false}` to a route that needs it.** Nothing can detect that
120
+ automatically — only you know whether a route is legitimately pre-organization.
121
+ - **Replacing calls to the four removed invitation routes.** If an out-of-tree script calls one, the
122
+ sync cannot see it.
@@ -271,28 +271,63 @@ Agents are autonomous resources that use an LLM and tools to complete a goal. Yo
271
271
 
272
272
  **Note:** Use `elevasis-sdk exec --async` when executing agents. Agents can run for minutes or longer, and the synchronous execute endpoint will time out for long-running runs. The `--async` flag returns an execution ID immediately and polls for the result.
273
273
 
274
+ There is no separate `agentConfig` object — agent-specific fields (`kind`, `systemPrompt`, `constraints`, `sessionCapable`, `securityLevel`, `memoryPreferences`) live directly on `config`, alongside the same identity fields a `WorkflowDefinition` uses. `modelConfig` is a sibling of `config`, not nested inside it. `kind` and `contract` are both required.
275
+
276
+ This example is a minimal single-shot (non-session) agent: one question in, one structured answer out. It is type-checked against the published `@elevasis/sdk` on every `pnpm check:docs-snippets` run — see `operations/src/example/example-agent.ts` in a scaffolded project for the working, OM-descriptor-bound copy (`resourceId` there derives from the OM Resource descriptor, same as the workflow example above; this version inlines the id directly to keep the snippet self-contained).
277
+
278
+ {/* doc-snippet:start:agent-definition-example */}
279
+
274
280
  ```typescript
275
281
  import type { AgentDefinition } from '@elevasis/sdk';
276
- import { resourceDescriptors } from '@core/config/organization-model';
282
+ import { z } from 'zod';
283
+
284
+ const inputSchema = z.object({
285
+ question: z.string().min(1),
286
+ });
287
+ const outputSchema = z.object({
288
+ answer: z.string(),
289
+ confidence: z.enum(['high', 'medium', 'low']),
290
+ });
277
291
 
278
292
  const myAgent: AgentDefinition = {
279
293
  config: {
280
- resource: resourceDescriptors.myAgent,
281
- resourceId: resourceDescriptors.myAgent.id,
282
- name: 'my-agent',
283
- type: resourceDescriptors.myAgent.kind,
284
- description: 'Answers questions using platform tools',
294
+ resourceId: 'my-agent',
295
+ name: 'My Agent',
296
+ description: 'Answers a single question with a structured, confidence-rated response.',
297
+ type: 'agent',
298
+ kind: 'utility',
299
+ version: '1.0.0',
285
300
  status: 'dev',
301
+ systemPrompt:
302
+ 'You answer a single question directly and concisely. State your confidence honestly.',
286
303
  },
287
- agentConfig: {
288
- model: { provider: 'openai', model: 'gpt-5' },
289
- systemPrompt: 'You are a helpful assistant.',
290
- maxIterations: 10,
291
- },
304
+ contract: { inputSchema, outputSchema },
292
305
  tools: [],
306
+ modelConfig: {
307
+ provider: 'anthropic',
308
+ model: 'claude-sonnet-5',
309
+ apiKey: process.env.ANTHROPIC_API_KEY ?? '',
310
+ },
293
311
  };
294
312
  ```
295
313
 
314
+ {/* doc-snippet:end:agent-definition-example */}
315
+
316
+ ### config (agent-specific fields)
317
+
318
+ | Field | Type | Description |
319
+ | ------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
320
+ | `kind` | `'orchestrator' | 'specialist' | 'utility' | 'platform'` | Required. What role this agent plays — not enforced at runtime today, but tenant-authored and validated at deploy against your OM resource descriptor's own `kind`. |
321
+ | `systemPrompt` | `string` | Required. The agent's base system prompt. |
322
+ | `constraints` | `{ maxIterations?, timeout?, maxSessionMemoryKeys?, maxMemoryTokens? }` (optional) | Iteration budget, execution timeout in ms, and session-memory limits. |
323
+ | `sessionCapable` | `boolean` (optional) | Opt in to multi-turn sessions. Defaults to `false` — the shape used in the example above, which completes and returns `contract.outputSchema` in a single turn. |
324
+ | `securityLevel` | `'standard' | 'hardened' | 'none'` (optional) | Prompt-hardening tier. Auto-derived from `sessionCapable` when omitted (`true` → `'hardened'`, `false` → `'standard'`). Never set `'none'` on a session-capable agent. |
325
+ | `memoryPreferences` | `string` (optional) | Guidance injected into the system prompt when session memory management is enabled. |
326
+
327
+ ### contract (agent)
328
+
329
+ `contract.inputSchema` is required, same as a workflow. `contract.outputSchema` is what a **non-session** (single-shot) agent like the example above returns — there is no conversational reply to read a structured answer from otherwise. A `sessionCapable: true` agent typically omits `outputSchema` and speaks through its conversational `message` instead.
330
+
296
331
  ---
297
332
 
298
333
  ## DeploymentSpec
@@ -59,20 +59,20 @@ config: {
59
59
 
60
60
  ## Execution Types
61
61
 
62
- | Type | Description |
63
- | -------------------- | ------------------------------------------------------------------------------ |
64
- | `WorkflowDefinition` | Complete workflow definition including config, contract, steps, and entryPoint |
65
- | `WorkflowStep` | Individual step definition with type, handler, and next routing |
66
- | `WorkflowConfig` | Metadata block: name, description, status, links, category |
67
- | `StepHandler` | Function type: `(input: unknown, context: StepContext) => Promise<unknown>` |
68
- | `NextConfig` | Union of `LinearNext` and `ConditionalNext` |
69
- | `LinearNext` | Fixed next step routing |
70
- | `ConditionalNext` | Branching step routing |
71
- | `StepType` | Runtime enum for step routing |
72
- | `AgentDefinition` | Complete agent definition including config, agentConfig, and tools |
73
- | `ExecutionContext` | Runtime context passed to step handlers |
74
- | `ExecutionMetadata` | Metadata about a running execution |
75
- | `ExecutionInterface` | Interface for triggering and inspecting executions |
62
+ | Type | Description |
63
+ | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
64
+ | `WorkflowDefinition` | Complete workflow definition including config, contract, steps, and entryPoint |
65
+ | `WorkflowStep` | Individual step definition with type, handler, and next routing |
66
+ | `WorkflowConfig` | Metadata block: name, description, status, links, category |
67
+ | `StepHandler` | Function type: `(input: unknown, context: StepContext) => Promise<unknown>` |
68
+ | `NextConfig` | Union of `LinearNext` and `ConditionalNext` |
69
+ | `LinearNext` | Fixed next step routing |
70
+ | `ConditionalNext` | Branching step routing |
71
+ | `StepType` | Runtime enum for step routing |
72
+ | `AgentDefinition` | Complete agent definition: `config` (agent-specific fields live here directly, not in a separate `agentConfig`), `contract`, `tools`, and `modelConfig` |
73
+ | `ExecutionContext` | Runtime context passed to step handlers |
74
+ | `ExecutionMetadata` | Metadata about a running execution |
75
+ | `ExecutionInterface` | Interface for triggering and inspecting executions |
76
76
 
77
77
  ## ElevasConfig
78
78