Skip to content

Commit ac78fa8

Browse files
authored
v0.9.22: docs overhaul, geo and mcp improvements
2 parents ca74862 + 4d4de52 commit ac78fa8

3,883 files changed

Lines changed: 618869 additions & 46273 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.agents/skills/add-block/SKILL.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ sourceIds.forEach((id) => delete params[id]) // subblock ids are deleted
350350
if (chosen !== undefined) params[group.canonicalId] = chosen
351351
```
352352

353-
So by the time `tools.config.params(inputs)` runs (`executor/handlers/generic/generic-handler.ts`),
353+
So by the time `tools.config.params(inputs)` runs (`executor/handlers/generic/handler.ts`),
354354
`params.uploadFile` and `params.fileRef` are **gone** and the value is under `params.file`. Reading a
355355
subblock id there yields `undefined` and silently sends no file.
356356

@@ -359,7 +359,7 @@ and the first non-empty advanced value in advanced mode, so a stale value in the
359359
never leak. `normalizeFileInput` then handles the JSON string that advanced-mode template resolution
360360
produces.
361361

362-
Note that `generic-handler` merges rather than replaces (`{ ...inputs, ...transformedParams }`), so
362+
Note that `generic/handler` merges rather than replaces (`{ ...inputs, ...transformedParams }`), so
363363
omitting a key from the returned object does not strip it from what the tool receives. Tools simply
364364
ignore params they do not declare.
365365

‎.agents/skills/add-integration/SKILL.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,8 +657,8 @@ File Downloads and Generated Files.
657657
| Helper | Location | Purpose |
658658
|--------|----------|---------|
659659
| `normalizeFileInput` | `@/blocks/utils` | Normalize file params in block config |
660-
| `processFilesToUserFiles` | `@/lib/uploads/utils/file-utils` | Convert raw inputs to UserFile[] |
661-
| `downloadFileFromStorage` | `@/lib/uploads/utils/file-utils.server` | Get file Buffer from UserFile |
660+
| `processFilesToUserFiles` | `@/lib/uploads/utils/file` | Convert raw inputs to UserFile[] |
661+
| `downloadFileFromStorage` | `@/lib/uploads/utils/file.server` | Get file Buffer from UserFile |
662662
| `FileToolProcessor` | `@/executor/utils/file-tool-processor` | Executor-side; stores declared file outputs (not called by tools) |
663663
| `isUserFile` | `@/lib/core/utils/user-file` | Type guard for UserFile objects |
664664
| `FileInputSchema` | `@/lib/uploads/utils/file-schemas` | Zod schema for file validation |

‎.agents/skills/add-managed-cli/SKILL.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Read these live sources before editing; do not copy their current entries into t
1515
2. `apps/sim/lib/execution/remote-sandbox/cli-tools.server.ts` — server-only recipes and recipe helpers.
1616
3. `apps/sim/lib/execution/remote-sandbox/cli-tools.test.ts` — catalog and supply-chain invariants.
1717
4. `apps/sim/lib/execution/remote-sandbox/cli-tools-boundary.test.ts` — client/server import boundary.
18-
5. `apps/sim/lib/execution/remote-sandbox/sandbox-spec.ts` — content-addressed hash inputs.
18+
5. `apps/sim/lib/execution/remote-sandbox/spec.ts` — content-addressed hash inputs.
1919

2020
Read `resolve.ts` and `e2b.ts` only when changing provisioning mechanics. A normal catalog addition should not require UI, API, database, resolver, or provider edits; those paths derive from the registries.
2121

@@ -114,7 +114,7 @@ Never commit downloaded artifacts or credentials.
114114
bun run --cwd apps/sim test \
115115
lib/execution/remote-sandbox/cli-tools.test.ts \
116116
lib/execution/remote-sandbox/cli-tools-boundary.test.ts \
117-
lib/execution/remote-sandbox/sandbox-spec.test.ts \
117+
lib/execution/remote-sandbox/spec.test.ts \
118118
lib/execution/remote-sandbox/resolve.test.ts \
119119
'app/workspace/[workspaceId]/settings/components/sandboxes/utils.test.ts'
120120
```

‎.agents/skills/add-trigger/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export function build{Service}Outputs(): Record<string, TriggerOutput> {
108108

109109
```typescript
110110
import { {Service}Icon } from '@/components/icons'
111-
import { buildTriggerSubBlocks } from '@/triggers'
111+
import { buildTriggerSubBlocks } from '@/triggers/subblocks'
112112
import { build{Service}ExtraFields, build{Service}Outputs, {service}SetupInstructions, {service}TriggerOptions } from '@/triggers/{service}/utils'
113113
import type { TriggerConfig } from '@/triggers/types'
114114

‎.agents/skills/migrate-application-operation/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Read these files completely before editing:
4747
- `apps/sim/lib/api/server/routes/internal-json-route.ts`
4848
- `apps/sim/lib/api/server/routes/v2-json-route.ts`
4949
- `apps/sim/lib/auth/internal-delegation.ts`
50-
- `apps/sim/lib/mothership/application/application-adapter.ts`
50+
- `apps/sim/lib/mothership/application/adapter.ts`
5151
- `apps/sim/lib/mothership/auth/application-delegation.ts`
5252

5353
Use the file domain only as a representative golden slice:
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
description: How stored content (workspace files, run files, knowledge, table rows) reaches Chat's model, and the per-path policy. Read before changing a use case, route or Chat surface that returns such content.
3+
paths:
4+
- "apps/sim/lib/core/application/**"
5+
- "apps/sim/lib/mothership/content-delivery/**"
6+
- "apps/sim/lib/workspace-files/application/**"
7+
- "apps/sim/lib/knowledge/application/**"
8+
- "apps/sim/lib/table/application/**"
9+
- "apps/sim/lib/workflows/application/**"
10+
- "apps/sim/lib/mothership/chat/application/**"
11+
- "apps/sim/lib/**/application/operations.ts"
12+
- "apps/sim/lib/mothership/agent-cli/**"
13+
- "apps/sim/lib/mothership/tools/**"
14+
- "apps/sim/app/api/v2/**"
15+
---
16+
17+
# Sim Content Delivery to Chat
18+
19+
Content derived from a provenance-bearing store reaches Chat's model only after **each item** it
20+
came from is admitted by the gate of the surface it leaves through. The stores are workspace files
21+
(and their versions), run files, knowledge documents and chunks, and table rows. "Derived" covers
22+
bytes, text, excerpts, chunks, cells, previews, base64, archives, rendered or compiled output,
23+
error text that quotes content, and public links. Counts, ordering, and match locations are ordinary
24+
metadata; this boundary protects supported literal secret values, not arbitrary inference. Intentional
25+
human uploads remain ordinary input and are not scanned.
26+
27+
Only Copilot principals (`delegated` / `organization_delegated` with `serviceId: 'copilot'`) are
28+
classified. Every other caller is admitted without a provenance read, so the UI, API keys, MCP and
29+
the workflow executor see byte-identical results.
30+
31+
## The pieces
32+
33+
- `lib/core/application/content-delivery.ts`: the primitive.
34+
- `admitContent(principal, sources)` returns per-item verdicts. `requireAdmittedContent` is the
35+
single-item form and throws `ContentRefusedError` (403).
36+
- `admitWrittenContent` is for a committed write that returns content. A refusal or gate failure
37+
does not undo the write: audit and effects run, then the operation answers with the refusal.
38+
Settled tool results use the same deferral, but do not claim that a mutation was saved.
39+
- A source is `{ kind, id, provenance, view }`. `view` is `'complete'` (text whose every entry
40+
may appear), `{ derived: value }` (only entries occurring in `value`), `'opaque'` (bytes no
41+
redaction reaches: binary, base64, archives, images, public links), or `'excerpt'` (text already
42+
cut before admission, where a secret fragment cannot be redacted). Both gates withhold an
43+
excerpt with known secret entries; raw opaque bytes may still enter the workbench with history.
44+
- `redactBeforeCutting` projects complete text before selecting a line window. The session gate
45+
creates the existing redactor from the operation's bounded evidence only when a cut needs it;
46+
ordinary byte reads do not decrypt a second time or reload history.
47+
- Gates, installed by the surface: the **registry gate** (Chat tools, CLI, mounts) imports entries
48+
into the registry egress projects with; the **session gate** (run_code sandbox proxy) records
49+
them into the workbench history. Neither admits `unknown`, with one exception: the CLI's direct
50+
single-file download (`files get`) admits it under `unknown: 'taint'`, which latches the call's
51+
registry so the whole output is withheld and the workbench copy stays unknown. It needs a
52+
registry to latch; without one it refuses. One refused item never latches the shared registry.
53+
- `observeContentOutsideModel` reads for Chat without classifying, for content that never reaches
54+
the model (the user's own edit preview; a derived file that carries its sources' provenance).
55+
Name why at each use.
56+
57+
## Rules
58+
59+
1. **Every operation that admits Copilot declares `contentDelivery`**: `'sourced'` when its result
60+
can carry content from a store, `'none'` otherwise. Definition throws
61+
without it, and `copilot-route-inventory.test.ts` lists every Chat-reachable route without one.
62+
2. **A `sourced` use case accounts for what it returns**, before it loads content: call
63+
`admitContent` (with `[]` when this call returns none). Otherwise Chat gets
64+
`ContentDeliveryUnaccountedError`, and the transports turn the response into a 403.
65+
3. **Classify before loading bytes**, and exclude refused items per item. Withhold a whole result
66+
only when its items cannot be separated (one file, one render, one compile).
67+
4. **A new `sourced` route needs a case in `lib/mothership/__integration__/content-delivery.integration.ts`.**
68+
`copilot-content-routes.json` lists them; the suite fails for a listed route it does not drive.
69+
Refresh the list with `vitest run lib/api/server/routes/copilot-route-inventory.test.ts --update=all`.
70+
5. **Do not reach a store's bytes around a use case for Chat.** A helper that reads content for
71+
Chat goes through the gated use case, or names `observeContentOutsideModel` and why.
72+
73+
## Policy
74+
75+
U = `unknown`, E = exact with secret entries, R/C = unrecorded or clean. Each item is decided on its
76+
own unless noted.
77+
78+
| Path | U | E | R / C |
79+
|---|---|---|---|
80+
| File download (CLI `files get`) | Delivered once; invocation withheld from the model; workbench copy stays unknown | Redacted | Delivered |
81+
| File download (run_code proxy) | Refused before bytes enter workbench history | Recorded in workbench history | Delivered |
82+
| Requested mounts | Refused before code executes, listed in `excludedInputs`; later calls remain usable | Recorded in workbench history | Delivered |
83+
| File text, version text, `files read`, grep | 403 | Redacted (grep redacts before clipping) | Delivered |
84+
| Bulk download zip | Left out, reported in the archive manifest | Left out (opaque), reported in the archive manifest | Included |
85+
| `files search` | Match location kept; clipped preview withheld | Same; read/grep provides safely redacted text | Returned |
86+
| File edit (`PATCH` content) | 403 before reading | Diagnostics redacted | Unchanged |
87+
| Chat public share activation, and seeing an existing link (any surface, run_code included) | 403 | 403 (a link leaves every gate) | Shares |
88+
| Rendered view, streamed image, inline attachments | Refused | Refused (opaque) | Delivered |
89+
| Doc compile | Actual file read refused | Evidence imported before broker bytes/errors return | Compiles, including dynamic file references |
90+
| Run file download | 403 | Redacted | Delivered |
91+
| Run read / execute / resume `base64` | `base64` removed, descriptor kept | Same | Inlined (sync runs only) |
92+
| KB chunks, search, documents, tags | Item dropped (single read: 403) | Redacted | Delivered |
93+
| KB export | Stream fails before refused source bytes; no successful archive receipt | Refused (opaque) | Streams originals/chunks with admission at each source |
94+
| Table export download | Existing unsupported Chat operation | | |
95+
| Table rows, query, read, `table_selection` | Row dropped (single read: 403) | Redacted | Delivered |
96+
| Row search | Locations returned without cell values | Same | Returned |
97+
| Table import from a file | Rows stored unknown | Per-cell entries; a row whose coercion rewrote a secret, or whose raw cells cannot be checked, is stored unknown | Exact-empty, as before |
98+
| `tools execute` | Settled result withheld, with no automatic retry | Named masking through the existing registry | Returned, subject to existing tool authorization |
99+
100+
Search pagination and aggregate totals retain their database meaning even when an item or preview is
101+
withheld. Do not scan unrelated table rows or whole document collections to conceal counts.
102+
A refused requested mount stops code before it runs, avoiding an older file at the same sandbox path.
103+
Registry admission commits only when the complete item fits the existing capacity; a refused item
104+
must not consume capacity or permanently disable the parent registry.

‎.claude/rules/sim-imports.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ paths:
99

1010
## Absolute Imports
1111

12-
**Always use absolute imports.** Never use relative imports, except that a barrel `index.ts` re-exports its own siblings relatively (`export { X } from './x'`).
12+
**Always use absolute imports.** Never use relative imports, except that a barrel `index.ts` re-exports its own siblings relatively (`export { X } from './x'`). `check:source-conventions` ratchets this per file.
1313

1414
```typescript
1515
// ✓ Good

‎.claude/rules/sim-sandbox.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ paths:
44
- "apps/sim/lib/execution/isolated-vm-worker.cjs"
55
- "apps/sim/lib/execution/isolated-vm.ts"
66
- "apps/sim/lib/execution/sandbox/**"
7-
- "apps/sim/sandbox-tasks/**"
7+
- "apps/sim/sandboxes/**"
88
---
99

1010
# Sim Sandbox — Worker Security Policy
@@ -40,7 +40,7 @@ about what must **never** live in that process.
4040
validation.
4141

4242
4. **Nothing that runs in the isolate is trusted, even if we wrote it**. The
43-
task `bootstrap` and `finalize` strings in `apps/sim/sandbox-tasks/` execute
43+
task `bootstrap` and `finalize` strings in `apps/sim/sandboxes/` execute
4444
inside the isolate. They must treat `globalThis` as adversarial — no pulling
4545
values from it that might have been mutated by user code. The hardening
4646
script in `executeTask` undefines dangerous globals before user code runs.

‎.claude/rules/sim-styling.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ paths:
1616
3. **Exact values over approximations** - `h-[26px]`, not `h-6`. But **type size is
1717
always a named token** (`text-sm`, `text-caption`) — never `text-[14px]`, which
1818
sets font-size only and inherits a different line-height. The scale is under
19-
"Text Scale" below.
19+
"Text Scale" below. `check:source-conventions` ratchets literal sizes the scale
20+
names, and style objects whose every value is static.
2021
4. **Transitions** - `transition-colors` for interactive states
2122

2223
## Conditional Classes

‎.claude/rules/sim-testing.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,17 @@ screenshot. Write it to a caller-supplied path (`<SUITE>_REPORT_PATH`) and have
6565
disposable, seeds with SQL, exercises the real HTTP boundary, cleans up its fixtures, and writes
6666
the report.
6767

68+
## Flaky tests
69+
70+
A daily job (`.github/workflows/ci-flakes.yml`) files a `ci-flake` issue for every test or job
71+
that failed on a CI attempt and passed when the same commit was re-run, and reopens it if the
72+
flake recurs after it was closed. Fix the nondeterminism it names: pin the clock
73+
(`vi.useFakeTimers({ toFake: ['Date'] })` + `vi.setSystemTime`), give each test its own ids and
74+
rows, wait on the condition rather than a delay, and keep cold imports out of a test's timeout by
75+
importing statically. Never add a retry, a skip, or a longer timeout to make one pass; raise a
76+
budget only when its run history shows the budget itself is wrong, and record that evidence
77+
beside it.
78+
6879
## Unit test mechanics
6980

7081
### Structure

0 commit comments

Comments
 (0)