@h1r-ai/croche 0.0.0-stage → 0.5.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/LICENSE +32 -0
- package/README.md +1184 -2
- package/THIRD-PARTY-NOTICES +5824 -0
- package/dist/archive.d.ts +47 -0
- package/dist/archive.js +217 -0
- package/dist/atomic-replace.d.ts +18 -0
- package/dist/atomic-replace.js +39 -0
- package/dist/commands.d.ts +56 -0
- package/dist/commands.js +1 -0
- package/dist/control.d.ts +62 -0
- package/dist/control.js +269 -0
- package/dist/core-abi.d.ts +110 -0
- package/dist/core-abi.js +1 -0
- package/dist/core-bindgen.d.ts +413 -0
- package/dist/core-bindgen.js +1533 -0
- package/dist/core-runtime.d.ts +214 -0
- package/dist/core-runtime.js +837 -0
- package/dist/core-wasm-bytes.d.ts +4 -0
- package/dist/core-wasm-bytes.js +5 -0
- package/dist/core-wasm.d.ts +16 -0
- package/dist/core-wasm.js +63 -0
- package/dist/debug.d.ts +26 -0
- package/dist/debug.js +171 -0
- package/dist/file-lock.d.ts +46 -0
- package/dist/file-lock.js +300 -0
- package/dist/images.d.ts +53 -0
- package/dist/images.js +179 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +9 -0
- package/dist/markers.d.ts +1 -0
- package/dist/markers.js +1 -0
- package/dist/node.d.ts +46 -0
- package/dist/node.js +281 -0
- package/dist/project-core.d.ts +79 -0
- package/dist/project-core.js +261 -0
- package/dist/project-session.d.ts +44 -0
- package/dist/project-session.js +143 -0
- package/dist/project-types.d.ts +97 -0
- package/dist/project-types.js +1 -0
- package/dist/project-wire.d.ts +19 -0
- package/dist/project-wire.js +39 -0
- package/dist/sse.d.ts +19 -0
- package/dist/sse.js +53 -0
- package/dist/storage.d.ts +24 -0
- package/dist/storage.js +32 -0
- package/dist/stream-branch.d.ts +47 -0
- package/dist/stream-branch.js +107 -0
- package/dist/stream-hub.d.ts +207 -0
- package/dist/stream-hub.js +210 -0
- package/dist/stream.d.ts +3 -0
- package/dist/stream.js +5 -0
- package/dist/types.d.ts +928 -0
- package/dist/types.js +8 -0
- package/dist/wiki.d.ts +15 -0
- package/dist/wiki.js +25 -0
- package/docs/CODING-AGENT.md +96 -0
- package/docs/DEBUGGER.md +230 -0
- package/docs/S2-IMPLEMENTATION.md +585 -0
- package/docs/SKILL.md +337 -0
- package/docs/skills/croche/agents/openai.yaml +4 -0
- package/docs/skills/croche/references/agents.md +78 -0
- package/docs/skills/croche/references/first-turn.md +74 -0
- package/docs/skills/croche/references/tools.md +43 -0
- package/docs/skills/croche-cli/SKILL.md +158 -0
- package/docs/skills/croche-cli/agents/openai.yaml +4 -0
- package/docs/skills/croche-cli/references/powershell.md +47 -0
- package/docs/skills/croche-config/SKILL.md +152 -0
- package/docs/skills/croche-config/agents/openai.yaml +4 -0
- package/docs/skills/croche-config/references/models.md +12 -0
- package/docs/skills/croche-platforms/SKILL.md +55 -0
- package/docs/skills/croche-platforms/agents/openai.yaml +4 -0
- package/docs/skills/croche-platforms/references/android.md +185 -0
- package/docs/skills/croche-platforms/references/ios.md +165 -0
- package/docs/skills/croche-platforms/references/react-native.md +50 -0
- package/docs/skills/croche-platforms/references/web-backend.md +58 -0
- package/docs/skills/croche-troubleshoot/SKILL.md +72 -0
- package/docs/skills/croche-troubleshoot/agents/openai.yaml +4 -0
- package/docs/skills/croche-troubleshoot/references/recovery.md +31 -0
- package/package.json +52 -4
- package/src/archive.ts +188 -0
- package/src/atomic-replace.ts +43 -0
- package/src/commands.ts +62 -0
- package/src/control.ts +179 -0
- package/src/core-abi.ts +52 -0
- package/src/core-bindgen.ts +1557 -0
- package/src/core-runtime.ts +750 -0
- package/src/core-wasm-bytes.ts +5 -0
- package/src/core-wasm.ts +57 -0
- package/src/debug.ts +160 -0
- package/src/file-lock.ts +269 -0
- package/src/images.ts +174 -0
- package/src/index.ts +15 -0
- package/src/markers.ts +1 -0
- package/src/node.ts +194 -0
- package/src/project-core.ts +231 -0
- package/src/project-session.ts +118 -0
- package/src/project-types.ts +77 -0
- package/src/project-wire.ts +39 -0
- package/src/sse.ts +57 -0
- package/src/storage.ts +30 -0
- package/src/stream-branch.ts +112 -0
- package/src/stream-hub.ts +249 -0
- package/src/stream.ts +7 -0
- package/src/types.ts +838 -0
- package/src/wiki.ts +25 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: croche-cli
|
|
3
|
+
description: Use the Croche CLI to create an app project and private debug-key file, inspect account/project metadata, edit a draft config, or attach the local debugger. Trigger on croche terminal commands or CLI setup, including PowerShell. Not for writing SDK app code or approving Studio-only actions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Croche CLI
|
|
7
|
+
|
|
8
|
+
Do the permitted CLI work and explain the next user action. Node.js 22+ on macOS/Linux;
|
|
9
|
+
Windows verification pending. Check `croche --help` and installed version before relying on
|
|
10
|
+
a command. CLI 0.5.1 is published on npm; platform and login verification remain separate.
|
|
11
|
+
With installation permission:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npm install -g @h1r-ai/croche-cli
|
|
15
|
+
croche --help
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The package is `@h1r-ai/croche-cli`; its executable is `croche`.
|
|
19
|
+
|
|
20
|
+
## Capture command output before it reaches the transcript
|
|
21
|
+
|
|
22
|
+
The CLI operations below may return credential prefixes. Use a capturing subprocess or shell
|
|
23
|
+
variable, parse the JSON privately, and output only required non-key fields (success, account ID,
|
|
24
|
+
project ID, destination path). Never echo raw JSON, stderr, `.credential.prefix` or `.debug_key.prefix`.
|
|
25
|
+
For a key presence check, emit only its variable name and presence/length; never masked substrings.
|
|
26
|
+
A successful user login is a signal to re-check now, not reuse an earlier failed check.
|
|
27
|
+
|
|
28
|
+
For a POSIX Node host, this identity check captures both streams and emits only a boolean:
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
import { spawnSync } from 'node:child_process';
|
|
32
|
+
const check = spawnSync('croche', ['auth', 'whoami', '--json'], {
|
|
33
|
+
encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'],
|
|
34
|
+
});
|
|
35
|
+
let authenticated = false;
|
|
36
|
+
try { authenticated = check.status === 0 && JSON.parse(check.stdout).ok === true; }
|
|
37
|
+
catch { /* Report only the safe status, never raw output. */ }
|
|
38
|
+
console.log(JSON.stringify({ authenticated }));
|
|
39
|
+
process.exitCode = authenticated ? 0 : 1;
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Use the same capture-and-allowlist pattern for project/debug-key commands. Do not print a
|
|
43
|
+
subprocess exception containing captured output. Use the PowerShell reference for that shell;
|
|
44
|
+
this example is not a Windows execution claim.
|
|
45
|
+
|
|
46
|
+
## Authenticate without collecting a secret
|
|
47
|
+
|
|
48
|
+
After installing the CLI, if the account is not already configured, make the same **one combined
|
|
49
|
+
request** as `croche`: sign up in Studio, create one account key (`dk_`) under **Account → Account
|
|
50
|
+
keys** (under **Personal**), then run **`croche login` themselves in any private terminal on the
|
|
51
|
+
same machine and OS account**, entering the key only at its hidden prompt (PowerShell that refuses
|
|
52
|
+
`croche` because scripts are disabled: the human first runs `Set-ExecutionPolicy -Scope CurrentUser RemoteSigned` once). For an empty app repo,
|
|
53
|
+
combine missing app purpose with that request. If neither the request nor repo reveals the platform,
|
|
54
|
+
add web/Node, React Native, Swift/iOS or Kotlin/Android to that same question. A known
|
|
55
|
+
platform already answers that choice. In an existing app, infer its purpose. Do not add a separate credential or project-choice questionnaire. Ask for completion,
|
|
56
|
+
not the key. The account key is different from the SDK debug key (`cdt_`).
|
|
57
|
+
|
|
58
|
+
**Never run login as the agent**, feed a key to its stdin, put one in argv, or open stored
|
|
59
|
+
credentials into the transcript. The user runs login; no shell export or agent restart is required.
|
|
60
|
+
TODO verify: the login/logout/identity contract against the matching released CLI:
|
|
61
|
+
|
|
62
|
+
- `croche login` validates the key before storing it and prints the account. Non-TTY login can
|
|
63
|
+
read stdin but never argv; that is for user-controlled private automation, not agent collection.
|
|
64
|
+
- Storage is in the OS config directory: XDG on Linux, `~/Library/Application Support` on macOS,
|
|
65
|
+
`%APPDATA%` on Windows; POSIX file mode **0600**, Windows user-only ACL. Windows is unverified.
|
|
66
|
+
- `croche auth whoami --json` returns account and credential metadata. Capture JSON privately;
|
|
67
|
+
emit only success, account ID and optionally source (`env` or `stored`), never raw output.
|
|
68
|
+
Do not print any part of a key, including prefixes/suffixes or masked previews.
|
|
69
|
+
Use it to verify the intended account; do not repeat private profile details unnecessarily.
|
|
70
|
+
- User-run `croche logout` removes stored credentials, not any environment value. For CI only,
|
|
71
|
+
secret-manager-provided `CROCHE_ACCOUNT_KEY` takes precedence over stored login. Do not print
|
|
72
|
+
its value or introduce an export as another onboarding step.
|
|
73
|
+
|
|
74
|
+
If login is unavailable, report a release blocker, not a guessed `npx` form or a secret-printing
|
|
75
|
+
workaround. An agent on another machine/container has a separate credential context; never copy
|
|
76
|
+
keys through chat to connect it. Then run `croche projects list --json`; reuse a project only
|
|
77
|
+
when the app clearly identifies it. Otherwise create an app-specific project in the requested
|
|
78
|
+
setup instead of asking the user to fetch/select keys. A **project ID** is not a public project key.
|
|
79
|
+
|
|
80
|
+
## Create the app setup without exposing the debug key
|
|
81
|
+
|
|
82
|
+
After the user completes signup, developer-key creation and `croche login`, do the rest:
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
croche projects create --name "My app" --json
|
|
86
|
+
croche debug-keys create --project PROJECT_ID --json
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Use the returned project ID and public project key; do not ask the user to retrieve them.
|
|
90
|
+
Before writing a secret, check that the chosen env-file path is not already tracked by Git;
|
|
91
|
+
never run a broad diff that could expose its contents. Project creation returns `data.project.id`
|
|
92
|
+
and `data.project.public_key` with `--json`. Reuse an existing intended project when appropriate
|
|
93
|
+
and keep account identity out of unnecessary reports.
|
|
94
|
+
|
|
95
|
+
**Candidate commands — TODO verify** against the matching published CLI:
|
|
96
|
+
|
|
97
|
+
- `croche debug-keys create --project PROJECT_ID --json` writes `CROCHE_DEBUG_KEY` (`cdt_`)
|
|
98
|
+
to `./.env`. Use only `data.debug_key.id` and `data.env_file` from privately captured
|
|
99
|
+
JSON result, **never a secret or prefix**. Do not treat this SDK credential as the CLI account key.
|
|
100
|
+
- `--env-file PATH` selects another file in an existing directory. A new file is **0600** on
|
|
101
|
+
POSIX; an existing file preserves its permissions and warns if too permissive. Check/fix
|
|
102
|
+
permissions without printing contents. Windows protection is unverified. The destination
|
|
103
|
+
is added to `.gitignore` in a Git repo, including custom paths; verify it is not tracked.
|
|
104
|
+
- An existing nonempty value is refused without `--force`. Preserve the existing file and
|
|
105
|
+
ask before replacing that credential; do not force, clear or retry creation automatically.
|
|
106
|
+
- `croche debug-keys list --project PROJECT_ID --json` returns `data.debug_keys` metadata.
|
|
107
|
+
- `croche debug-keys revoke --project PROJECT_ID KEY_ID --json` revokes the selected ID;
|
|
108
|
+
`data.debug_key` is the result metadata. Revoke only that explicitly authorized key, not
|
|
109
|
+
other keys or every key in the project. Check the installed help matches this candidate.
|
|
110
|
+
|
|
111
|
+
Never use `--print`: that is a human-only private-terminal option.
|
|
112
|
+
Do not use an older CLI's secret output as a workaround. If creation times out, inspect safe
|
|
113
|
+
metadata before retrying; do not assume it failed. Load the file directly into the app process,
|
|
114
|
+
for example `node --env-file=.env first-turn.mjs`, without exposing it in chat or shell output.
|
|
115
|
+
|
|
116
|
+
## Common work
|
|
117
|
+
|
|
118
|
+
| Task | Command (replace `PROJECT_ID` locally) |
|
|
119
|
+
| --- | --- |
|
|
120
|
+
| Project details | `croche projects get PROJECT_ID --json` |
|
|
121
|
+
| Usage and remaining allowance | `croche projects usage PROJECT_ID --period week --json` |
|
|
122
|
+
| Recent reported operations | `croche projects operations PROJECT_ID --limit 20 --json` |
|
|
123
|
+
| Debug-key metadata | `croche debug-keys list --project PROJECT_ID --json` |
|
|
124
|
+
| Server-key metadata | `croche keys server list PROJECT_ID --json` |
|
|
125
|
+
| App verification settings | `croche attestation get PROJECT_ID --json` |
|
|
126
|
+
| Draft to a local file | `croche config get --project PROJECT_ID -o draft.json` |
|
|
127
|
+
| Save requested draft edits | `croche config save draft.json --project PROJECT_ID --note "Update instructions"` |
|
|
128
|
+
| Draft and released versions | `croche config list --project PROJECT_ID` |
|
|
129
|
+
|
|
130
|
+
For config edits, load `croche-config` if installed: drafts replace the entire config and
|
|
131
|
+
reach development installs. Read the draft before editing; preserve its other fields. On
|
|
132
|
+
`draft_conflict`, get the current draft into a **different file**, reconcile with the user's
|
|
133
|
+
edit, and save deliberately. Do not force an empty base or blindly retry. The human reviews
|
|
134
|
+
cards and diff at **Build → AI config → Running config**, chooses **Release…**, and types the
|
|
135
|
+
project name to approve. Production installs apply the release on their next open after sync.
|
|
136
|
+
Studio is not a draft editor.
|
|
137
|
+
|
|
138
|
+
Debug-key creation/list/revoke use the candidate CLI flow above. Guide the user to Studio for
|
|
139
|
+
account developer-key or server-key administration, app verification, budgets, project
|
|
140
|
+
pause/archive or production release. A `dk_` credential does not authorize bypassing human-only approval.
|
|
141
|
+
|
|
142
|
+
## Debug the app already running
|
|
143
|
+
|
|
144
|
+
`croche debug` lists running apps for the user to choose. For an agent/noninteractive session,
|
|
145
|
+
use `croche debug runtimes --json`, then `croche debug connect --runtime-id RUNTIME_ID` after
|
|
146
|
+
selecting the intended app. No account key is needed for this local debugger path. Keep the
|
|
147
|
+
printed viewer/pairing link private. Do not attach an unrelated app, expose the local viewer
|
|
148
|
+
publicly, or send/reset user conversations merely to obtain a trace.
|
|
149
|
+
|
|
150
|
+
## Read results correctly
|
|
151
|
+
|
|
152
|
+
`--json` gives `{ok:true,data}` or `{ok:false,error:{code,message,details?}}`.
|
|
153
|
+
Exit classes: **0** success, **1** remote failure, **2** usage/configuration,
|
|
154
|
+
**3** authentication/authorization, **4** transport/timeout. A timeout is not proof a write failed.
|
|
155
|
+
Stop on errors; consult `croche-troubleshoot` if available. Report only necessary, redacted data.
|
|
156
|
+
|
|
157
|
+
For PowerShell encoding, exit handling and quoting, read
|
|
158
|
+
[powershell.md](references/powershell.md). Do not replace an unverified command with a guess.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# PowerShell syntax (Windows verification pending)
|
|
2
|
+
|
|
3
|
+
Use when the user's terminal is PowerShell. These forms are guidance; do not report Windows
|
|
4
|
+
support or a successful Windows run without executing there.
|
|
5
|
+
|
|
6
|
+
Call plain `croche` in PowerShell. If PowerShell refuses it because running scripts is disabled
|
|
7
|
+
(npm's `croche.ps1`), the human runs **`Set-ExecutionPolicy -Scope CurrentUser RemoteSigned`**
|
|
8
|
+
once, as part of the login request; you never change the execution policy yourself. After you
|
|
9
|
+
install the CLI, the user runs **`croche login`** in their private terminal; you never run it or see their key. No
|
|
10
|
+
PowerShell environment assignment is needed for onboarding. Login remains pending verification.
|
|
11
|
+
|
|
12
|
+
Capture authentication output without displaying prefixes; report only a boolean:
|
|
13
|
+
|
|
14
|
+
```powershell
|
|
15
|
+
$raw = croche auth whoami --json 2>$null
|
|
16
|
+
$exit = $LASTEXITCODE
|
|
17
|
+
$authenticated = $false
|
|
18
|
+
try { $authenticated = ($exit -eq 0 -and ($raw | ConvertFrom-Json).ok -eq $true) }
|
|
19
|
+
catch { $authenticated = $false }
|
|
20
|
+
@{ authenticated = $authenticated } | ConvertTo-Json -Compress
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Do not echo `$raw`. After the human says done, re-check now and continue to the first authorized
|
|
24
|
+
live turn in the same turn; do not stop on a stale missing-file result. For private key files,
|
|
25
|
+
check presence/length only, never prefixes/suffixes or masked substrings.
|
|
26
|
+
|
|
27
|
+
```powershell
|
|
28
|
+
[Console]::OutputEncoding = [Text.UTF8Encoding]::new()
|
|
29
|
+
$result = croche projects list --json | ConvertFrom-Json
|
|
30
|
+
if ($LASTEXITCODE -ne 0) { throw "Croche failed; inspect the redacted error code." }
|
|
31
|
+
# Inspect only necessary project fields, not secrets or unrelated account details.
|
|
32
|
+
$result.data.projects | Select-Object id, name
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
- Use `$LASTEXITCODE`, not just `$?`, for the native command's exit class.
|
|
36
|
+
- Windows PowerShell 5.1 has no `&&`; run a command then check `$LASTEXITCODE`.
|
|
37
|
+
- CLI text/JSON input files must be UTF-8. In Windows PowerShell 5.1, use
|
|
38
|
+
`Set-Content -Path draft.json -Value $json -Encoding UTF8`; `>` / `Out-File` default to
|
|
39
|
+
UTF-16 there and cause `unsupported_encoding`. Preserve the entire fetched draft when editing.
|
|
40
|
+
- Single quotes are literal; double quotes expand variables. Quote paths containing spaces.
|
|
41
|
+
- Prefer a supported file option over free-text command arguments containing embedded quotes
|
|
42
|
+
or shell metacharacters. For local runtime commands with `--text-file`, write UTF-8 and pass
|
|
43
|
+
the path; check that subcommand's help first. Do not invent a file option for another command.
|
|
44
|
+
|
|
45
|
+
Do not run POSIX inline assignments (`KEY=value command`), `export`, or Bash heredocs in
|
|
46
|
+
PowerShell. If the environment cannot run the command, prepare files and ask the user to run
|
|
47
|
+
the check; ask only for a redacted error code and exit status, never their environment dump.
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: croche-config
|
|
3
|
+
description: Edit or diagnose Croche project config, model selection, Studio drafts and releases, app tool declarations, or language selection. Use when instructions differ after restart, a draft removes tools, or user locale selects the wrong config. Not for CLI installation or unrelated app localization.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# App configuration
|
|
7
|
+
|
|
8
|
+
Work on the app-visible config, not service implementation. Determine whether the requested
|
|
9
|
+
change is bundled app config, a development draft, or a production release before editing.
|
|
10
|
+
Use `Croche.open({ config, handlers, ... })` for project configuration.
|
|
11
|
+
|
|
12
|
+
## Choose a model in app config
|
|
13
|
+
|
|
14
|
+
**Your app can choose the model.** Set `model` inside the `config` passed to `Croche.open`,
|
|
15
|
+
not as a top-level open option:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
const config = {
|
|
19
|
+
model: 'deepseek/deepseek-v4.1-flash',
|
|
20
|
+
instructions: 'You are a friendly guide. Keep replies brief.',
|
|
21
|
+
};
|
|
22
|
+
// Use this as the config option in your existing Croche.open call.
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
| Scope | Config field |
|
|
26
|
+
| --- | --- |
|
|
27
|
+
| Project | `config.model` |
|
|
28
|
+
| Project language | `config.languages.<tag>.model` |
|
|
29
|
+
| Agent | `config.agents.<agentId>.model` |
|
|
30
|
+
| Agent language | `config.agents.<agentId>.languages.<tag>.model` |
|
|
31
|
+
|
|
32
|
+
For the selected agent and language, later applicable levels override earlier ones in that
|
|
33
|
+
order: project → project language → agent → agent language. Omitting `model` at one level
|
|
34
|
+
inherits the preceding applicable value. Modes do not declare `model`.
|
|
35
|
+
|
|
36
|
+
## Recommended models
|
|
37
|
+
|
|
38
|
+
| Model | When to use it | USD / 1M tokens (input / output) | Latency in the comparison below |
|
|
39
|
+
| --- | --- | --- | --- |
|
|
40
|
+
| `deepseek/deepseek-v4.1-flash` | Recommended default for text + images and low-latency chat | $0.2002 / $0.9856 | Median **0.9 s**, p90 **1.6 s**; observed **~$0.00013/turn** |
|
|
41
|
+
| `openai/gpt-6-luna` | Text + image alternative; fallback subject to the reasoning limits below | $0.1114 / $0.5571 | Not measured in this comparison |
|
|
42
|
+
| `deepseek/deepseek-v4-flash-0731` | Text-only apps seeking cheaper output than V4.1; not for image input | $0.1773 / $0.6584 | Not measured in this comparison |
|
|
43
|
+
| `xiaomi/mimo-v2.6-flash` | Low token cost, but only background or latency-tolerant work | $0.14 / $0.29 | Median **11.2 s**, p90 **23.5 s**, max **54 s** |
|
|
44
|
+
| `anthropic/claude-opus-5.5` | Work/productivity where quality justifies higher cost; not recommended for entertainment/chat companions | $4.5455 / $22.7273 | Not measured in this comparison |
|
|
45
|
+
| `openai/gpt-6.1-sol` | Work/document agents that accept higher cost for quality; not recommended for entertainment/chat companions | $2.2286 / $11.1429 | Not measured in this comparison |
|
|
46
|
+
|
|
47
|
+
Prices are estimates from the Studio catalog's **2026-10-05** snapshot, in USD per million
|
|
48
|
+
input/output tokens, not a fixed per-turn charge. MiMo has the lowest output price in this
|
|
49
|
+
shortlist, but the lowest token price is not the fastest response.
|
|
50
|
+
|
|
51
|
+
Latency and observed turn cost above come from **one 32-turn Croche Chat comparison on
|
|
52
|
+
2026-10-13**, not a service guarantee or a general benchmark. Prompt size, output length and
|
|
53
|
+
workload affect both time and cost. Measure your app; do not extrapolate those timings to the
|
|
54
|
+
models marked unmeasured.
|
|
55
|
+
|
|
56
|
+
Set **project-level `config.model` explicitly**. Infer image use from the requested feature or
|
|
57
|
+
existing code; do not add a setup question when that is clear. Preserve the user's explicit
|
|
58
|
+
model choice. Do not use the text-only option for an app that sends images.
|
|
59
|
+
|
|
60
|
+
The default when no applicable config level sets `model` is
|
|
61
|
+
**`deepseek/deepseek-v4.1-flash`**, with **`openai/gpt-6-luna`** as fallback.
|
|
62
|
+
That fallback applies only when `reasoning` is **`default` or `off`**. With `low`, `medium`,
|
|
63
|
+
or `high`, the fallback is dropped; do not promise an automatic switch to the alternative.
|
|
64
|
+
|
|
65
|
+
This default is live. Set `config.model` explicitly when your app needs a particular model.
|
|
66
|
+
Listing an alternative is not a guarantee that every explicit model choice automatically
|
|
67
|
+
falls back to it. Public SDK package availability remains a separate release check.
|
|
68
|
+
|
|
69
|
+
Read the online [Models page](https://docs.croche.ai/models.md) for recommendations and the
|
|
70
|
+
[documentation index](https://docs.croche.ai/llms.txt) to discover other public pages. The
|
|
71
|
+
[full allowed list](references/models.md) is included offline and is also available in Studio.
|
|
72
|
+
Do not invent a model name or say model choice is unavailable.
|
|
73
|
+
|
|
74
|
+
## Rules that prevent broken apps
|
|
75
|
+
|
|
76
|
+
- A Studio AI config, draft or release, **replaces the app's code config as a whole**. It does
|
|
77
|
+
not merge with the bundled config. Preserve instructions, tools, agents and other app fields.
|
|
78
|
+
- A downloaded config applies at the **next open after a sync**, never in the active session.
|
|
79
|
+
Restarting once before the download finishes can still use the old config; allow sync and
|
|
80
|
+
reopen again. Do not promise that saving a draft changes an already-open agent.
|
|
81
|
+
- Drafts reach only installs using a **debug key (`debugKey`)**. Every debug key
|
|
82
|
+
follows drafts by default; there is **no toggle** to enable this.
|
|
83
|
+
- A config declaring a tool the app does not register is **not delivered**. Keep declaration
|
|
84
|
+
names and app handler registration consistent; handlers stay in code.
|
|
85
|
+
- **A draft must include every tool the app uses, or the agent loses those tools at next open.**
|
|
86
|
+
Export/read the whole current draft before an edit, not just the instructions field.
|
|
87
|
+
- `CrocheRuntime.create` never uses Studio config; only `Croche.open` does. Do not suggest
|
|
88
|
+
switching a draft to fix a low-level single-agent integration.
|
|
89
|
+
|
|
90
|
+
## Agent authors; human reviews in Studio
|
|
91
|
+
|
|
92
|
+
Studio is not a draft editor. Make a requested config edit through the CLI, not an imaginary
|
|
93
|
+
Draft tab or Save draft button. Get the current draft before editing so save checks its base:
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
croche config get --project PROJECT_ID --output croche.config.json
|
|
97
|
+
# Edit croche.config.json, preserving the complete config and every required tool.
|
|
98
|
+
croche config save croche.config.json --project PROJECT_ID
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Preserve the full project document. If no draft exists, prepare `schema: 2` with the complete
|
|
102
|
+
app config in `config`, not the returned `null`. On a conflict, keep the local edit, fetch the
|
|
103
|
+
latest draft separately and reconcile; do not force an empty base or blindly overwrite.
|
|
104
|
+
Saving affects debug-key apps, not production: every debug key follows drafts. Verify all tool
|
|
105
|
+
handlers, allow sync and reopen; the change applies on the **next open after sync**, never
|
|
106
|
+
mid-session. Test the behavior and check **Monitoring → Logs**.
|
|
107
|
+
|
|
108
|
+
For production, the **human** opens **Build → AI config → Running config**, reviews the draft's
|
|
109
|
+
readable cards and diff against the released config, and chooses **Release…**. The human types
|
|
110
|
+
the project name and chooses **Approve and publish**. Production installs apply the released
|
|
111
|
+
config on their next open after sync; release alone does not prove application. Never release,
|
|
112
|
+
roll back or change spending limits as a side effect of a draft edit.
|
|
113
|
+
|
|
114
|
+
App-code reports may say **“Running config reports are not available yet.”** Do not promise
|
|
115
|
+
those reports: draft review and release remain available below. Missing reports do not prove
|
|
116
|
+
app health or which config is currently effective.
|
|
117
|
+
|
|
118
|
+
## Language: the user, not the config author
|
|
119
|
+
|
|
120
|
+
`language` passed to `Croche.open` is **the user's language**, a BCP-47 tag. It selects the
|
|
121
|
+
matching translated config branch, `config.languages.<tag>`: exact tag first, then primary
|
|
122
|
+
subtag. If none matches, the base config is used **as is**. An English-only config still serves
|
|
123
|
+
a Korean user.
|
|
124
|
+
|
|
125
|
+
`config.defaultLanguage` is the language the **base config is written in** (default `en`),
|
|
126
|
+
not the user's language and not a fallback language assigned to the user. It belongs at the
|
|
127
|
+
project config root, not among the `Croche.open` host options or inside an agent override.
|
|
128
|
+
|
|
129
|
+
When the app passes no `language`, SDKs use the device/browser locale: browser
|
|
130
|
+
`navigator.language`; automatic RN/Swift/Kotlin device locale is targeted for **0.5.1**.
|
|
131
|
+
TODO verify mobile 0.5.1 behavior before relying on it. On earlier RN versions, pass the app's
|
|
132
|
+
known user locale explicitly. On a Node backend, pass the authenticated user's app locale;
|
|
133
|
+
the server has no browser/device locale for that person.
|
|
134
|
+
|
|
135
|
+
The model is **not told this language value**. It replies in the language the user writes
|
|
136
|
+
unless instructions say otherwise. Selecting a config branch neither translates app data nor
|
|
137
|
+
forces the reply language. Do not set `defaultLanguage` from each user's preference.
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
const config = {
|
|
141
|
+
model: 'deepseek/deepseek-v4.1-flash',
|
|
142
|
+
defaultLanguage: 'en',
|
|
143
|
+
instructions: 'You are a friendly guide.',
|
|
144
|
+
languages: { ko: { instructions: 'You are a friendly guide for our Korean edition.' } },
|
|
145
|
+
};
|
|
146
|
+
// In Croche.open: { ...hostOptions, language: 'ko-KR', config }
|
|
147
|
+
// ko-KR selects ko here. With no ko branch, the English base stays unchanged.
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Keep translations limited to fields whose content actually differs; do not duplicate a whole
|
|
151
|
+
config for every locale without need. Whole Studio-config replacement is a separate rule from
|
|
152
|
+
choosing a language branch within that config.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Allowed model IDs
|
|
2
|
+
|
|
3
|
+
Use an exact ID below for the `model` field in a Croche project config. These are the IDs
|
|
4
|
+
supported by the current SDK candidate; public package availability remains pending verification.
|
|
5
|
+
|
|
6
|
+
{{ALLOWED_MODEL_IDS}}
|
|
7
|
+
|
|
8
|
+
A model ID outside this list is not a supported app config choice. Match the list to the SDK
|
|
9
|
+
version you actually ship; do not invent IDs or infer input support from another product's catalog.
|
|
10
|
+
For recommendations, config levels and default/fallback behavior, read
|
|
11
|
+
[the config skill](../SKILL.md) or the online [Models page](https://docs.croche.ai/models.md).
|
|
12
|
+
The [documentation index](https://docs.croche.ai/llms.txt) lists every public Markdown page.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: croche-platforms
|
|
3
|
+
description: Set up Croche for React Native, a web backend, or native Swift/Kotlin. Use for platform imports, storage, development versus server credentials, mobile locale, and native release readiness. Not for ordinary Node first-turn setup or generic platform development without Croche.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Choose the correct platform integration
|
|
7
|
+
|
|
8
|
+
Preserve the user's target platform. Explain what is ready and what needs verification rather
|
|
9
|
+
than silently converting their app to another platform. Croche runs the model for the app;
|
|
10
|
+
use the usage and limits shown in Studio, not a separate model-service setup.
|
|
11
|
+
|
|
12
|
+
| Target | Path | Read when needed |
|
|
13
|
+
| --- | --- | --- |
|
|
14
|
+
| Local Node check | `@h1r-ai/croche`, durable `FileStorage`, SDK debug key | Core `croche` skill |
|
|
15
|
+
| React Native | `Croche` from `@h1r-ai/croche-react-native`, SDK-managed storage | [react-native.md](references/react-native.md) |
|
|
16
|
+
| Web (local and production) | `Croche` on the app's Node backend, server key stays there | [web-backend.md](references/web-backend.md) |
|
|
17
|
+
| iOS · Swift | SPM, exact **0.5.1**, `Croche.open` | [ios.md](references/ios.md) |
|
|
18
|
+
| Android · Kotlin | Maven, exact **0.5.1**, `Croche.open` | [android.md](references/android.md) |
|
|
19
|
+
|
|
20
|
+
Node.js 22+ on macOS/Linux; Windows verification pending. PowerShell syntax does not establish
|
|
21
|
+
Windows support. SDK 0.5.1 is published on npm; verify the installed version and platform behavior.
|
|
22
|
+
Node and RN do not automatically load the CLI-created `.env`: Node needs `--env-file` or an
|
|
23
|
+
existing dotenv loader, web secrets stay server-side only, and RN needs debug-only build config
|
|
24
|
+
with no secret in release artifacts. Read the matching reference above before the first turn.
|
|
25
|
+
For account CLI login and shell syntax, use `croche-cli` if installed; a `dk_` key is
|
|
26
|
+
never an app credential.
|
|
27
|
+
|
|
28
|
+
## Language option on every platform
|
|
29
|
+
|
|
30
|
+
`language` is the **user's BCP-47 language**, selecting a translated `config.languages` branch.
|
|
31
|
+
No match uses the base as written in `config.defaultLanguage`; it does not force a reply
|
|
32
|
+
language. Omitted language uses browser `navigator.language`; RN/Swift/Kotlin automatic device
|
|
33
|
+
locale is targeted for 0.5.1 (TODO verify). Pass the known user locale explicitly on earlier RN
|
|
34
|
+
or a Node backend. The model replies to the user's language unless instructions say otherwise.
|
|
35
|
+
Use `croche-config` for the complete selection and next-open rules.
|
|
36
|
+
|
|
37
|
+
## Native gate
|
|
38
|
+
|
|
39
|
+
**Native Swift and Kotlin SDKs exist.** Their shared **project/agent `Croche.open` API** is
|
|
40
|
+
coming in **0.5.1**. Do not describe a pending API/release as nonexistent SDKs.
|
|
41
|
+
Candidate installation and `Croche.open` first-turn examples are in [ios.md](references/ios.md)
|
|
42
|
+
and [android.md](references/android.md). For a native request, read the matching reference,
|
|
43
|
+
prepare the integration and check exact 0.5.1 availability. TODO verify: package resolution,
|
|
44
|
+
simulator/emulator first turn and release credential exclusion. Do not substitute the native
|
|
45
|
+
0.5.0 single-agent API or claim the candidate was run. Use git-ignored `.xcconfig` (iOS) or
|
|
46
|
+
`local.properties` (Android), wired only into Debug and excluded from Release at build time.
|
|
47
|
+
If a native release is unavailable, report that blocker; offer TypeScript/React Native for a
|
|
48
|
+
new hackathon app, but never rewrite an existing native app into a different stack unasked.
|
|
49
|
+
|
|
50
|
+
## Verify the actual target
|
|
51
|
+
|
|
52
|
+
Build and run on the selected simulator/emulator/backend; note its SDK version and OS.
|
|
53
|
+
Check one completed reply and persistence, and inspect a release bundle/config to ensure it
|
|
54
|
+
does not contain development or CLI credentials. Production app verification is configured
|
|
55
|
+
by the user at **Settings → App verification**; a simulator check does not verify a device release.
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# Android · Kotlin project API
|
|
2
|
+
|
|
3
|
+
Use this guide for a native Android app, not the single-agent API. It targets **0.5.1** and
|
|
4
|
+
`Croche.open` → `agent()` → `request()`.
|
|
5
|
+
|
|
6
|
+
> TODO verify: 0.5.1 Maven availability, Gradle integration, emulator first turn and release
|
|
7
|
+
> credential exclusion. These are candidate instructions, not a claim of a published or tested
|
|
8
|
+
> native release. If the exact package is unavailable, report that blocker; do not downgrade the API.
|
|
9
|
+
|
|
10
|
+
## Install from Maven
|
|
11
|
+
|
|
12
|
+
Requires **minSdk 26+**. Add the repository to the existing `settings.gradle.kts` repositories:
|
|
13
|
+
|
|
14
|
+
```kotlin
|
|
15
|
+
dependencyResolutionManagement {
|
|
16
|
+
repositories {
|
|
17
|
+
google()
|
|
18
|
+
mavenCentral()
|
|
19
|
+
maven("https://maven.croche.ai")
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Add the exact dependency in `app/build.gradle.kts`:
|
|
25
|
+
|
|
26
|
+
```kotlin
|
|
27
|
+
dependencies {
|
|
28
|
+
implementation("ai.croche:croche-android:0.5.1")
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The distribution supplies the native binary and dependency metadata. No manual Rust/NDK build
|
|
33
|
+
or copied AAR is needed for this install path. Preserve the app's existing Android/Kotlin setup.
|
|
34
|
+
Windows verification is pending; these Gradle examples are not a Windows support claim.
|
|
35
|
+
|
|
36
|
+
## One human step; the agent sets up the project
|
|
37
|
+
|
|
38
|
+
The coding agent installs the CLI with permission. The human signs up at
|
|
39
|
+
[Studio](https://studio.croche.ai), creates one account key under **Account → Account keys**, and
|
|
40
|
+
runs **`croche login`** privately. Never ask for a key in chat or run login for them. Reuse a
|
|
41
|
+
confirmed login. After the human says done, re-check authentication and the private key file,
|
|
42
|
+
then continue setup and the first authorized live turn in the same turn. Capture CLI JSON
|
|
43
|
+
privately; emit only success/IDs/file paths, never raw output, prefixes or any part of a key.
|
|
44
|
+
For key checks, presence/length only. The agent creates/reuses the project and obtains its **public** project key:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
croche auth whoami --json
|
|
48
|
+
croche projects create --name "My app" --json
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Do not request a public project key or SDK debug key from the user. The account key
|
|
52
|
+
is only for CLI authentication; it never goes in the app.
|
|
53
|
+
|
|
54
|
+
## Keep the debug key in local.properties, Debug only
|
|
55
|
+
|
|
56
|
+
Android does not load the CLI's default `.env`. From the Android project root, verify that
|
|
57
|
+
`local.properties` is git-ignored and not tracked, then have the agent run:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
croche debug-keys create --project PROJECT_ID --env-file local.properties --json
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Use the project ID returned above. The CLI preserves existing entries such as `sdk.dir` and
|
|
64
|
+
writes `CROCHE_DEBUG_KEY` without printing its secret. It refuses an existing nonempty key
|
|
65
|
+
unless force is explicitly approved. Never use secret-print output or show the file. Existing
|
|
66
|
+
file permissions are preserved: restrict them to the user without displaying contents; Windows
|
|
67
|
+
file-protection verification is still pending. Git-ignore is not release protection.
|
|
68
|
+
|
|
69
|
+
In `app/build.gradle.kts`, load the private setting into the **Debug build type only** and use an
|
|
70
|
+
empty value for **Release**. Merge this with existing configuration rather than replacing it:
|
|
71
|
+
|
|
72
|
+
```kotlin
|
|
73
|
+
import java.util.Properties
|
|
74
|
+
|
|
75
|
+
val crocheLocal = Properties().apply {
|
|
76
|
+
val localFile = rootProject.file("local.properties")
|
|
77
|
+
if (localFile.isFile) localFile.inputStream().use { load(it) }
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
android {
|
|
81
|
+
defaultConfig { minSdk = 26 }
|
|
82
|
+
buildFeatures { buildConfig = true }
|
|
83
|
+
buildTypes {
|
|
84
|
+
getByName("debug") {
|
|
85
|
+
val key = crocheLocal.getProperty("CROCHE_DEBUG_KEY", "")
|
|
86
|
+
require(key.isEmpty() || Regex("cdt_[a-f0-9]{64}").matches(key)) {
|
|
87
|
+
"Invalid Croche debug-key format."
|
|
88
|
+
}
|
|
89
|
+
buildConfigField("String", "CROCHE_DEBUG_KEY", "\"$key\"")
|
|
90
|
+
}
|
|
91
|
+
getByName("release") {
|
|
92
|
+
buildConfigField("String", "CROCHE_DEBUG_KEY", "\"\"")
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Do not put the key in `defaultConfig`, resources, the manifest, assets or a shared build field.
|
|
99
|
+
Apply the same exclusion to any custom distribution build types; never copy `local.properties`
|
|
100
|
+
or `.env` into the app. A runtime `BuildConfig.DEBUG` check alone cannot remove an embedded secret.
|
|
101
|
+
Keep verbose build output and build caches containing Debug artifacts private. See Android's
|
|
102
|
+
[build configuration guidance](https://developer.android.com/build/gradle-tips).
|
|
103
|
+
|
|
104
|
+
## First completed reply
|
|
105
|
+
|
|
106
|
+
Put this in your app module, importing the **app's own namespace** `BuildConfig` if the source
|
|
107
|
+
package differs. Replace `projectKey` with the public key obtained by the agent and `userID`
|
|
108
|
+
with the app's stable user ID. Call from the app's existing coroutine scope and render the result.
|
|
109
|
+
This one-shot check closes its project; a real app keeps one project open for the user session.
|
|
110
|
+
|
|
111
|
+
```kotlin
|
|
112
|
+
import com.google.gson.JsonParser
|
|
113
|
+
import dev.croche.Croche
|
|
114
|
+
import dev.croche.InputStatus
|
|
115
|
+
import dev.croche.MessageStatus
|
|
116
|
+
import dev.croche.OpenOptions
|
|
117
|
+
import dev.croche.SendInput
|
|
118
|
+
import java.util.UUID
|
|
119
|
+
import kotlinx.coroutines.NonCancellable
|
|
120
|
+
import kotlinx.coroutines.withContext
|
|
121
|
+
|
|
122
|
+
suspend fun firstCrocheReply(projectKey: String, userID: String): String {
|
|
123
|
+
val debugKey = if (BuildConfig.DEBUG) {
|
|
124
|
+
BuildConfig.CROCHE_DEBUG_KEY.also {
|
|
125
|
+
check(it.isNotBlank()) { "Debug key is not loaded." }
|
|
126
|
+
}
|
|
127
|
+
} else null
|
|
128
|
+
val config = JsonParser.parseString(
|
|
129
|
+
"""{"model":"deepseek/deepseek-v4.1-flash","instructions":"Help the user with this app."}"""
|
|
130
|
+
).asJsonObject
|
|
131
|
+
val croche = Croche.open(OpenOptions(
|
|
132
|
+
projectKey = projectKey,
|
|
133
|
+
config = config,
|
|
134
|
+
user = userID,
|
|
135
|
+
debugKey = debugKey,
|
|
136
|
+
))
|
|
137
|
+
try {
|
|
138
|
+
val agent = croche.agent()
|
|
139
|
+
val result = agent.request(SendInput(id = UUID.randomUUID().toString(), text = "Hello!"))
|
|
140
|
+
val text = result.messages.filter { it.status == MessageStatus.COMPLETED }
|
|
141
|
+
.joinToString("\n") { it.text }
|
|
142
|
+
check(result.status == InputStatus.ANSWERED && text.isNotEmpty()) {
|
|
143
|
+
"No completed reply; inspect the result status."
|
|
144
|
+
}
|
|
145
|
+
return text
|
|
146
|
+
} finally {
|
|
147
|
+
withContext(NonCancellable) { croche.close() }
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
The SDK supplies app-private storage on Android; do not pass a Node storage adapter or a JVM
|
|
153
|
+
project directory. A `send` receipt alone is not a completed reply. For new messages use new
|
|
154
|
+
IDs; preserve the ID and payload when retrying the same input. Respect the app's usage
|
|
155
|
+
authorization before a paid turn.
|
|
156
|
+
|
|
157
|
+
## Options and configuration
|
|
158
|
+
|
|
159
|
+
| Option | App-visible meaning |
|
|
160
|
+
| --- | --- |
|
|
161
|
+
| `projectKey` | Public project key returned by CLI project creation |
|
|
162
|
+
| `config` | Complete app code config; set `model` explicitly when you want a particular model |
|
|
163
|
+
| `user` | Stable app user ID; do not mix different users in one open project |
|
|
164
|
+
| `debugKey` | SDK debug credential loaded only for Debug; `null` in Release |
|
|
165
|
+
| `language` | User's BCP-47 language; defaults to the device locale when omitted in 0.5.1 |
|
|
166
|
+
|
|
167
|
+
`language` selects `config.languages.<tag>` by exact tag, then primary subtag. If none matches,
|
|
168
|
+
the base config is used as is, written in `config.defaultLanguage` (default `en`): that is the
|
|
169
|
+
config's authored language, **not** the user's. An English-only config can serve a Korean user.
|
|
170
|
+
The model is not told `language`; it replies in the language the user writes unless instructions
|
|
171
|
+
say otherwise. See [config and language](https://docs.croche.ai/concepts/config.md).
|
|
172
|
+
|
|
173
|
+
A Studio config replaces the whole code config at the **next open after sync**, never mid-session.
|
|
174
|
+
Debug-key installs follow drafts. Include **every tool** the app uses and register its handlers.
|
|
175
|
+
Choose a model using [Models](https://docs.croche.ai/models.md).
|
|
176
|
+
|
|
177
|
+
## Verify before shipping
|
|
178
|
+
|
|
179
|
+
- Resolve exactly 0.5.1, build Debug and run on the selected emulator. Confirm a nonempty,
|
|
180
|
+
completed reply; report the real error if it fails. In Studio, inspect **Monitoring → Logs**
|
|
181
|
+
with the development filter. Never paste credentials or private app data into the report.
|
|
182
|
+
- Inspect a clean Release APK/AAB without printing secrets: no debug key in classes/resources,
|
|
183
|
+
no `local.properties`/`.env` bundled, no CLI credential. Git-ignore alone is not enough.
|
|
184
|
+
- Production uses the app's verification setup under **Settings → App verification**, not a
|
|
185
|
+
shipped debug key. An emulator run does not prove real-device production verification.
|