@oddington/cli 0.1.27 → 0.1.29

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 (3) hide show
  1. package/README.md +156 -29
  2. package/dist/os.js +239 -203
  3. package/package.json +3 -2
package/README.md CHANGED
@@ -22,6 +22,11 @@ Run `os --help` or add `--help` to any command for the full command list.
22
22
  Commands print readable output by default. Add `--json` when another program
23
23
  will consume the result.
24
24
 
25
+ Sign-in and session operations use `https://auth.oddington.ai`. Connection
26
+ management, repository targets, local app repository context, Dropbox authorization,
27
+ remote File-storage configuration and Routine deployment use `https://api.oddington.ai`. These addresses are fixed; workspace
28
+ configuration and `ODDINGTON_OS_ORIGIN` do not override them.
29
+
25
30
  ## Local apps
26
31
 
27
32
  From anywhere inside the app’s Git worktree, run:
@@ -247,6 +252,38 @@ Airtable expects:
247
252
  Creating a connection verifies access before saving it. It does not grant
248
253
  anyone permission to use it.
249
254
 
255
+ Outlook and SharePoint are separate connections for one mailbox or site. Both
256
+ require tenant and application IDs, declared access, and protected credential
257
+ JSON from stdin:
258
+
259
+ ```sh
260
+ credential-source | os connection create outlook \
261
+ --workspace <workspace> \
262
+ --name accounts-payable \
263
+ --tenant-id <tenant-id> \
264
+ --client-id <client-id> \
265
+ --mailbox-email invoices@example.test \
266
+ --access read \
267
+ --credentials-stdin
268
+
269
+ credential-source | os connection create sharepoint \
270
+ --workspace <workspace> \
271
+ --name operations \
272
+ --tenant-id <tenant-id> \
273
+ --client-id <client-id> \
274
+ --site-url https://example.sharepoint.com/sites/Operations \
275
+ --access read-write \
276
+ --credentials-stdin
277
+ ```
278
+
279
+ Each expects an object containing only `clientSecret`. The entire UTF-8 stdin
280
+ input must fit within 4,096 bytes. The secret never belongs in command arguments.
281
+ Outlook accepts only `read`; SharePoint accepts `read` or `read-write`. OS resolves
282
+ the SharePoint site ID during verification; callers cannot supply it.
283
+ The Entra application's Microsoft permissions and site or mailbox grants must
284
+ already be configured upstream. V0 manages and verifies these connections;
285
+ it does not provide Microsoft routine operations or SharePoint File storage.
286
+
250
287
  ### Test a connection
251
288
 
252
289
  ```sh
@@ -266,6 +303,13 @@ Gmail verification checks the configured account and scopes without reading
266
303
  messages. Airtable verification makes a read-only schema request; it does not
267
304
  prove that the credential can write records.
268
305
 
306
+ Outlook testing reads only the configured mailbox's inbox folder identity,
307
+ without reading messages or attachments. SharePoint testing resolves the site
308
+ URL to its saved ID and reads that site. Success establishes readable access
309
+ only, including when declared access is `read-write`; it does not prove write
310
+ access or the absence of broader Microsoft access. Inspect shows the complete
311
+ public configuration, including the verified SharePoint site ID.
312
+
269
313
  ### Grant and use a connection
270
314
 
271
315
  Use `os whoami` to find your user ID, then grant access explicitly:
@@ -303,6 +347,13 @@ To rotate Gmail or Airtable credentials, repeat the matching `create` command
303
347
  with the same name and external account or base. The new credentials are tested
304
348
  before replacing the old ones.
305
349
 
350
+ For Outlook or SharePoint, repeat the matching `create` command with the same
351
+ provider and name and fresh credential stdin. Successful verification replaces
352
+ the credential while preserving the connection ID and history; failure leaves
353
+ the prior connection intact. Disconnect removes that connection's protected
354
+ credential without changing Microsoft permissions or other connections using
355
+ the same secret. Reconnecting requires fresh verified credentials.
356
+
306
357
  To stop new use of a connection:
307
358
 
308
359
  ```sh
@@ -324,6 +375,33 @@ and other CLI output never reveal saved credentials.
324
375
  `ODDINGTON_CONNECTION_CREDENTIAL`. Only run trusted code, and do not print or
325
376
  retain that value.
326
377
 
378
+ ## Deploy and roll back routines
379
+
380
+ From the installed routine's customer Git worktree, a signed-in workspace
381
+ member can run:
382
+
383
+ ```sh
384
+ os routine deploy invoice-import
385
+ os routine rollback invoice-import
386
+ ```
387
+
388
+ Deploy reads `routines/invoice-import/routine.json` and packages the exact
389
+ eligible current source, including eligible uncommitted changes, plus frozen
390
+ dependencies. The declaration must match every installed access grant. OS
391
+ builds and checks definitions, then activates only a compatible ready version;
392
+ a failure preserves the current active version. Deployment never invokes
393
+ business code or creates installation authority.
394
+
395
+ The command reports phases, bounded diagnostics, the opaque version, source
396
+ summary, runtime profile/features and capability names. Closing the CLI stops
397
+ inspection while accepted OS work continues. Repeat the identical command to
398
+ resume its deployment; source uploads and accepted seals recover lost replies.
399
+ Rollback selects the preceding compatible retained version on OS without a
400
+ rebuild. Both commands accept only the routine name and `--json` output option;
401
+ they accept no commit, module, image, command, credential or version selector.
402
+ JSON returns product facts without progress prose and uses the same exit status
403
+ as human output.
404
+
327
405
  ## Publish asks and digests
328
406
 
329
407
  A signed-in workspace member can publish an initial ask whose Questions have
@@ -382,31 +460,43 @@ login. For a manual run, a signed-in workspace member uses the installed
382
460
  routine's name. OS supplies only the connections declared by its installation:
383
461
 
384
462
  ```sh
385
- os routine run --workspace example --name invoice-import \
386
- -- node routines/invoice-import/run.ts
463
+ os routine run invoice-import --input input.json
464
+ os routine run invoice-import --input - --json
387
465
  ```
388
466
 
389
- OS resolves the active deployment, supplies temporary routine authority to the
390
- child, and revokes it when the process exits. A record read contains
391
- one authoritative commit and selected
392
- `{ ref, version, fields }` records in requested order. Keep versions opaque and
393
- save them with the reviewed records. A local checkout cannot supply this evidence.
467
+ OS matches the current Git worktree to exactly one authenticated installed
468
+ workspace/routine and resolves `routines/invoice-import/run.ts`. The entry exports
469
+ an inert `defineRoutine` definition from `@oddington/sdk`. No handler deployment
470
+ is required unless an authored item declares executable handlers. JSON input
471
+ is validated before business work; its file/stdin path is transport, not input.
472
+ Omitted input is `{}`. Each JSON value is bounded to 256 KiB.
394
473
 
395
- To inspect the same routine's work before publication, use `prepare`:
474
+ Before execution, the command names installed connections and explains that
475
+ local filesystem changes, model calls and provider effects happen immediately.
476
+ Only Record, File, Ask and Digest changes stay local for review. The child
477
+ receives temporary installed authority, which is revoked when execution ends.
478
+ Success reports concrete nonzero counts and the stable Run reference:
396
479
 
397
480
  ```sh
398
- os routine prepare --workspace example --name invoice-import \
399
- -- node routines/invoice-import/run.ts
400
481
  os routine publish
401
- os routine publish --run <prepared-run>
482
+ os routine publish <run>
483
+ os routine publish <run> --json
402
484
  ```
403
485
 
404
- The SDK calls stay the same. Declared records appear in the matched checkout;
405
- exact files, captured receipts and authored items stay in a private sealed run
406
- under the Git directory. The command prints its inspection location and run
407
- reference. Connections can still contact their providers. A failed child cannot
408
- publish. Inspect the files and bounded Git diff, then publish from the original
409
- root. With several ready runs, select one using `--run`.
486
+ Declared records appear in the matched checkout; exact files, captured receipts,
487
+ source/input and authored items stay in the private Run directory
488
+ `.git/oddington-prepared/<run>` (under the worktree's actual Git directory).
489
+ `execution.json` retains steps, optional result, redacted child output and known
490
+ effect evidence. `complete.json` seals successful intent. Inspect these files and
491
+ the bounded Git diff, then publish from the original root. Bare publish lists
492
+ ready references and refuses ambiguity. A failed or cancelled Run cannot publish;
493
+ earlier local/provider effects remain real. A successful Run with no OS changes
494
+ retains its evidence and says “Nothing needs to be sent to OS.”
495
+
496
+ `--json` emits one value on stdout; notices use stderr and child logs stay in
497
+ Run evidence. Run output includes `runId`, `state`, `placement`, `changes`,
498
+ `counts`, optional declared `result`, and `directory`. Publish output includes
499
+ the same Run reference, change state, confirmed receipts, Files, items and links.
410
500
 
411
501
  The SDK's `data.repository(name)` collection, selection and search calls also work in
412
502
  this mode, using only installed repository grants and the exact committed
@@ -418,15 +508,26 @@ unchanged; replaying an older publication cannot rewind it. For example,
418
508
  `general.records.search('acme overdue', { collections: ['invoices'], limit: 20 })`
419
509
  returns bounded full Records with guards usable in Changes, or empty matches
420
510
  with the searched version. Missing/incomplete search data fails retryably with
421
- `unavailable`, and a dead parent has no hosted fallback. Ordinary immediate
422
- `os routine run` continues to deliver search through the hosted service.
423
- A run that only reads or validates creates no prepared-run directory
424
- and reports completion without a publish instruction. Authentication and named
511
+ `unavailable`, and a dead parent has no hosted fallback. Authentication and named
425
512
  provider connections retain their normal network and authority requirements;
426
- preparation does not promise offline execution and may contact OS or providers.
427
- Execution location and File storage are independent of this publication choice.
428
- `os routine run --local` remains a deprecated compatibility alias for
429
- `os routine prepare` and prints the replacement command.
513
+ local execution may contact OS or providers.
514
+
515
+ Local execution requires native Node TypeScript stripping, a module
516
+ `routines/package.json`, a matching `engines.node`, and an installed SDK.
517
+ Before inspection, OS pins reachable ESM/CommonJS modules, runtime packages,
518
+ governing package metadata and literal `new URL` assets, up to 20,000 files /
519
+ 256 MiB. Unrelated routines, historical output, unused dependencies, caches and
520
+ logs are excluded. Reachable symlinks, native addons, computed loaders/assets
521
+ and unsupported exports refuse; execution never uses changing checkout code.
522
+ No dependency installation or package script runs. Run state is bounded to
523
+ 64 MiB; reports and redacted output each retain at most 10 MiB. Launcher ownership
524
+ renews every 20 seconds with a 90-second lease; execution retains the existing
525
+ 15-minute capability bound.
526
+
527
+ `routine prepare`, `run --local`, executable/argv selection, routine workspace,
528
+ name and working-root flags, and publish `--run` are retired. Remote execution,
529
+ deployment and schedules are unavailable in this release. `os run --connection`
530
+ remains the separate ad hoc command; app children still publish immediately.
430
531
 
431
532
  `changes.delete(record)` captures the selected `$ref` and `$version`. A mixed
432
533
  create/update/delete group prepares one guarded proposal; validation creates no
@@ -434,7 +535,7 @@ proposal or materialization. Local publication removes only declared Records,
434
535
  returns their captured identities in `deleted`, and advances subsequent run
435
536
  reads to the exact prepared version. Files and durable Source uses remain
436
537
  retained. Deleted paths are sealed as absent: recreating one before
437
- `os routine publish --run <prepared-run>` invalidates publication before effects.
538
+ `os routine publish <run>` invalidates publication before effects.
438
539
  Later publication rechecks the complete group at its captured base, applies one
439
540
  exact commit and waits for its exact hosted index. Interrupted Git or index
440
541
  acknowledgements resume that same proposal and preserve the inspected identities.
@@ -442,7 +543,7 @@ acknowledgements resume that same proposal and preserve the inspected identities
442
543
  Publication checks the whole run before effects, applies exact record history,
443
544
  retains files, then publishes Asks and Digests. It preserves unrelated local
444
545
  work. Changed prepared bytes, authority or unrelated remote movement require
445
- repair and a new preparation; publication never rebases inspected work.
546
+ repair and a new Run; publication never rebases inspected work.
446
547
  After interruption, repeat the same publish command with unchanged content.
447
548
  `publication.json` journals attempted operations and confirmed receipts
448
549
  separately from sealed intent. Fresh launches recover original commit, file and
@@ -489,8 +590,9 @@ or attach anything. CSV parsing hints (`csv.encoding`, `csv.delimiter`,
489
590
  `csv.headerRow`) are optional. OS derives the row count, size, digest, media type
490
591
  and verified PDF pages. Unsupported files remain preserved and downloadable.
491
592
 
492
- Set `workingRoot` in the SDK, `--working-root` on the file command or routine
493
- launcher, or `ODDINGTON_INBOX_WORKING_ROOT`. The default is the current directory:
593
+ Member-authored files may use `workingRoot` in the SDK, `--working-root` on the
594
+ file command, or `ODDINGTON_INBOX_WORKING_ROOT`. Named routine Runs receive
595
+ their resolved worktree root from OS. The file command defaults to the current directory:
494
596
 
495
597
  ```sh
496
598
  os files add --workspace <workspace> --working-root <local-root> --path <relative-file-path> --json
@@ -505,6 +607,31 @@ an item containing them.
505
607
  Resolution is an explicit guarded business outcome from a handler or the
506
608
  original publishing routine.
507
609
 
610
+ Delete an unused shared File as its signed-in creator:
611
+
612
+ ```sh
613
+ os files delete --workspace <workspace> --id <file-id> --yes --json
614
+ ```
615
+
616
+ `--yes` explicitly confirms removal of the original and every retained
617
+ enrichment. Without confirmation the command refuses before authentication or
618
+ deletion work. A Source or another independent use conflicts without changing
619
+ the File; delete that use through its owning capability first. Read access does
620
+ not allow deleting another member's or an installed routine's File.
621
+
622
+ The command uses the published SDK and the CLI member session. Configured
623
+ `ODDINGTON_FILES_ROOT` selects the existing managed local owner, including
624
+ uploaded-cache cleanup. Success means physical cleanup and durable completion;
625
+ repeating a completed command succeeds. Temporary failures remain retryable,
626
+ and a pending File stays inaccessible. R2 cleanup removes only the exact pinned
627
+ registered object and confirms absence; a changed identity fails with integrity.
628
+ Human output names the workspace and File ID. JSON success is one document:
629
+ `{"workspace":"playground","id":"<file-id>","status":"deleted"}`.
630
+ Failures exit nonzero with the bounded Files error category.
631
+ After interruption or a lost reply, repeat the same confirmed command and ID;
632
+ do not create a replacement File to recover deletion. A completed retry needs
633
+ no provider connection, but still requires current creator authority.
634
+
508
635
  ## Package boundary
509
636
 
510
637
  `@oddington/cli` contains the `os` executable and depends on the compatible