@lore-co/cli 0.2.26 → 0.2.28
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/README.md +67 -20
- package/dist/agents.d.ts +9 -0
- package/dist/agents.d.ts.map +1 -1
- package/dist/agents.js +19 -6
- package/dist/agents.js.map +1 -1
- package/dist/api.d.ts +2 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +15 -2
- package/dist/api.js.map +1 -1
- package/dist/approach-guidance.d.ts +8 -1
- package/dist/approach-guidance.d.ts.map +1 -1
- package/dist/approach-guidance.js +13 -3
- package/dist/approach-guidance.js.map +1 -1
- package/dist/approach.d.ts.map +1 -1
- package/dist/approach.js +2 -2
- package/dist/approach.js.map +1 -1
- package/dist/ask.d.ts.map +1 -1
- package/dist/ask.js +2 -2
- package/dist/ask.js.map +1 -1
- package/dist/capture-repair.d.ts +11 -0
- package/dist/capture-repair.d.ts.map +1 -0
- package/dist/capture-repair.js +94 -0
- package/dist/capture-repair.js.map +1 -0
- package/dist/capture-scope.d.ts.map +1 -1
- package/dist/capture-scope.js +2 -1
- package/dist/capture-scope.js.map +1 -1
- package/dist/chat.d.ts.map +1 -1
- package/dist/chat.js +2 -2
- package/dist/chat.js.map +1 -1
- package/dist/cli.d.ts +114 -6
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +628 -127
- package/dist/cli.js.map +1 -1
- package/dist/codex-hook-approval.d.ts.map +1 -1
- package/dist/codex-hook-approval.js +9 -2
- package/dist/codex-hook-approval.js.map +1 -1
- package/dist/command-help.d.ts +3 -2
- package/dist/command-help.d.ts.map +1 -1
- package/dist/command-help.js +11 -5
- package/dist/command-help.js.map +1 -1
- package/dist/config-command.js +2 -2
- package/dist/config-command.js.map +1 -1
- package/dist/connect-project.d.ts.map +1 -1
- package/dist/connect-project.js +2 -1
- package/dist/connect-project.js.map +1 -1
- package/dist/console-keys.d.ts +11 -0
- package/dist/console-keys.d.ts.map +1 -0
- package/dist/console-keys.js +24 -0
- package/dist/console-keys.js.map +1 -0
- package/dist/cursor-mcp.d.ts.map +1 -1
- package/dist/cursor-mcp.js +4 -0
- package/dist/cursor-mcp.js.map +1 -1
- package/dist/demo-process.js +3 -3
- package/dist/demo-process.js.map +1 -1
- package/dist/devin-capture.d.ts.map +1 -1
- package/dist/devin-capture.js +2 -2
- package/dist/devin-capture.js.map +1 -1
- package/dist/devin-cli.d.ts.map +1 -1
- package/dist/devin-cli.js +23 -13
- package/dist/devin-cli.js.map +1 -1
- package/dist/devin-client.d.ts +3 -0
- package/dist/devin-client.d.ts.map +1 -1
- package/dist/devin-client.js +5 -0
- package/dist/devin-client.js.map +1 -1
- package/dist/devin.d.ts.map +1 -1
- package/dist/devin.js +29 -9
- package/dist/devin.js.map +1 -1
- package/dist/drafts.d.ts +8 -0
- package/dist/drafts.d.ts.map +1 -0
- package/dist/drafts.js +173 -0
- package/dist/drafts.js.map +1 -0
- package/dist/generated-assets.d.ts +9 -9
- package/dist/generated-assets.d.ts.map +1 -1
- package/dist/generated-assets.js +9 -9
- package/dist/generated-assets.js.map +1 -1
- package/dist/github.d.ts.map +1 -1
- package/dist/github.js +46 -14
- package/dist/github.js.map +1 -1
- package/dist/guard.d.ts +1 -1
- package/dist/guard.d.ts.map +1 -1
- package/dist/guard.js +42 -14
- package/dist/guard.js.map +1 -1
- package/dist/handoff.js +2 -2
- package/dist/handoff.js.map +1 -1
- package/dist/host.js +4 -4
- package/dist/host.js.map +1 -1
- package/dist/image-capture.d.ts.map +1 -1
- package/dist/image-capture.js +5 -4
- package/dist/image-capture.js.map +1 -1
- package/dist/learnings.d.ts.map +1 -1
- package/dist/learnings.js +3 -3
- package/dist/learnings.js.map +1 -1
- package/dist/live.d.ts +7 -0
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +11 -6
- package/dist/live.js.map +1 -1
- package/dist/lore-agent.d.ts +6 -1
- package/dist/lore-agent.d.ts.map +1 -1
- package/dist/lore-agent.js +29 -7
- package/dist/lore-agent.js.map +1 -1
- package/dist/mcp-config.d.ts +7 -0
- package/dist/mcp-config.d.ts.map +1 -1
- package/dist/mcp-config.js +19 -3
- package/dist/mcp-config.js.map +1 -1
- package/dist/npm-installation.js +2 -2
- package/dist/npm-installation.js.map +1 -1
- package/dist/owned-files.d.ts +14 -4
- package/dist/owned-files.d.ts.map +1 -1
- package/dist/owned-files.js +24 -9
- package/dist/owned-files.js.map +1 -1
- package/dist/platform.d.ts +26 -3
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +87 -20
- package/dist/platform.js.map +1 -1
- package/dist/pty.d.ts +2 -1
- package/dist/pty.d.ts.map +1 -1
- package/dist/pty.js +20 -7
- package/dist/pty.js.map +1 -1
- package/dist/recovery-cloud-receipt.d.ts.map +1 -1
- package/dist/recovery-cloud-receipt.js +2 -1
- package/dist/recovery-cloud-receipt.js.map +1 -1
- package/dist/recovery-cloud-workspace.d.ts.map +1 -1
- package/dist/recovery-cloud-workspace.js +2 -1
- package/dist/recovery-cloud-workspace.js.map +1 -1
- package/dist/recovery-cloud.d.ts.map +1 -1
- package/dist/recovery-cloud.js +8 -9
- package/dist/recovery-cloud.js.map +1 -1
- package/dist/recovery-copilot.d.ts.map +1 -1
- package/dist/recovery-copilot.js +3 -2
- package/dist/recovery-copilot.js.map +1 -1
- package/dist/recovery-desktop.d.ts.map +1 -1
- package/dist/recovery-desktop.js +3 -2
- package/dist/recovery-desktop.js.map +1 -1
- package/dist/recovery-hooks.js +2 -2
- package/dist/recovery-hooks.js.map +1 -1
- package/dist/recovery-hosts.d.ts.map +1 -1
- package/dist/recovery-hosts.js +53 -6
- package/dist/recovery-hosts.js.map +1 -1
- package/dist/recovery-polytoken.d.ts +2 -2
- package/dist/recovery-polytoken.d.ts.map +1 -1
- package/dist/recovery-polytoken.js +13 -8
- package/dist/recovery-polytoken.js.map +1 -1
- package/dist/recovery-remote.js +3 -3
- package/dist/recovery-remote.js.map +1 -1
- package/dist/recovery-state.d.ts +22 -1
- package/dist/recovery-state.d.ts.map +1 -1
- package/dist/recovery-state.js +167 -31
- package/dist/recovery-state.js.map +1 -1
- package/dist/recovery-transfer.d.ts.map +1 -1
- package/dist/recovery-transfer.js +8 -4
- package/dist/recovery-transfer.js.map +1 -1
- package/dist/recovery.d.ts +5 -2
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +37 -14
- package/dist/recovery.js.map +1 -1
- package/dist/reliability-store.d.ts +13 -0
- package/dist/reliability-store.d.ts.map +1 -1
- package/dist/reliability-store.js +110 -8
- package/dist/reliability-store.js.map +1 -1
- package/dist/remember.d.ts.map +1 -1
- package/dist/remember.js +32 -3
- package/dist/remember.js.map +1 -1
- package/dist/retained-context.d.ts.map +1 -1
- package/dist/retained-context.js +3 -2
- package/dist/retained-context.js.map +1 -1
- package/dist/retrieval-task.d.ts +30 -0
- package/dist/retrieval-task.d.ts.map +1 -1
- package/dist/retrieval-task.js +98 -2
- package/dist/retrieval-task.js.map +1 -1
- package/dist/review.d.ts +1 -1
- package/dist/review.d.ts.map +1 -1
- package/dist/review.js +12 -7
- package/dist/review.js.map +1 -1
- package/dist/runtime.d.ts +4 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +147 -97
- package/dist/runtime.js.map +1 -1
- package/dist/self-host.d.ts +1 -1
- package/dist/self-host.d.ts.map +1 -1
- package/dist/self-host.js +105 -23
- package/dist/self-host.js.map +1 -1
- package/dist/share.d.ts.map +1 -1
- package/dist/share.js +2 -1
- package/dist/share.js.map +1 -1
- package/dist/signed-snapshot.d.ts +7 -0
- package/dist/signed-snapshot.d.ts.map +1 -1
- package/dist/signed-snapshot.js +27 -0
- package/dist/signed-snapshot.js.map +1 -1
- package/dist/skill-command.d.ts +5 -2
- package/dist/skill-command.d.ts.map +1 -1
- package/dist/skill-command.js +73 -10
- package/dist/skill-command.js.map +1 -1
- package/dist/skill-guidance.js +1 -1
- package/dist/skill-guidance.js.map +1 -1
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +9 -7
- package/dist/skills.js.map +1 -1
- package/dist/status-health.d.ts +26 -0
- package/dist/status-health.d.ts.map +1 -0
- package/dist/status-health.js +49 -0
- package/dist/status-health.js.map +1 -0
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +2 -2
- package/dist/telemetry.js.map +1 -1
- package/dist/terminal-output.d.ts +76 -0
- package/dist/terminal-output.d.ts.map +1 -0
- package/dist/terminal-output.js +151 -0
- package/dist/terminal-output.js.map +1 -0
- package/dist/uninstall.d.ts.map +1 -1
- package/dist/uninstall.js +3 -1
- package/dist/uninstall.js.map +1 -1
- package/dist/update.d.ts +3 -0
- package/dist/update.d.ts.map +1 -1
- package/dist/update.js +40 -14
- package/dist/update.js.map +1 -1
- package/dist/windows-permissions.d.ts +6 -0
- package/dist/windows-permissions.d.ts.map +1 -1
- package/dist/windows-permissions.js +22 -2
- package/dist/windows-permissions.js.map +1 -1
- package/dist/windows-pty.d.ts.map +1 -1
- package/dist/windows-pty.js +4 -3
- package/dist/windows-pty.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -124,6 +124,28 @@ lore connect \
|
|
|
124
124
|
--agent claude
|
|
125
125
|
```
|
|
126
126
|
|
|
127
|
+
`connect` reports the workspace, where Lore records, one line per agent, and the
|
|
128
|
+
steps left for you:
|
|
129
|
+
|
|
130
|
+
```text
|
|
131
|
+
✓ Connected to Acme
|
|
132
|
+
Recording in ~/acme · capture on
|
|
133
|
+
|
|
134
|
+
Claude Code ✓ ready after restart, allow the lore server when asked
|
|
135
|
+
Codex ✓ ready after restart, approve hooks with /hooks
|
|
136
|
+
|
|
137
|
+
Next
|
|
138
|
+
1. Restart the agents above.
|
|
139
|
+
2. In ~/acme, ask your agent anything, then check https://uselore.co/connect.
|
|
140
|
+
|
|
141
|
+
Try: "Lore, has anything like this come up before?" · /recap to save a session
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The test step names a folder Lore records in. With capture off or paused it
|
|
145
|
+
checks context delivery with `lore doctor` instead. Add `--verbose` for the API
|
|
146
|
+
URL, the config file, and every file written. `--json` prints the full result
|
|
147
|
+
for scripts.
|
|
148
|
+
|
|
127
149
|
Keep manual tokens out of agent prompts and use a separate revocable token per
|
|
128
150
|
machine or integration. For copy-paste hosted and self-host prompts, human
|
|
129
151
|
approval points, verification, and rollback, see the
|
|
@@ -376,10 +398,9 @@ verify enforcement again. Existing supported written rules remain valid.
|
|
|
376
398
|
|
|
377
399
|
```sh
|
|
378
400
|
lore guard status # effective mode here, and why
|
|
379
|
-
lore guard assist #
|
|
380
|
-
lore guard enforce --repo # override for the repo you're in
|
|
381
|
-
lore guard clear-override --repo # remove
|
|
382
|
-
lore guard off # workspace default back to off
|
|
401
|
+
lore guard assist # workspace default from off to assist
|
|
402
|
+
lore guard enforce --repo # stricter override for the repo you're in
|
|
403
|
+
lore guard clear-override --repo # remove an override weaker than the default
|
|
383
404
|
lore guard approve <check-id> # confirm a blocked action
|
|
384
405
|
```
|
|
385
406
|
|
|
@@ -392,17 +413,20 @@ OpenCode block the call and include the `lore guard approve` command in the
|
|
|
392
413
|
message. Native hooks and OpenCode preserve known Enforce during outages using
|
|
393
414
|
a verified saved policy and block Guard-eligible actions if no usable policy
|
|
394
415
|
exists. Changing modes requires an
|
|
395
|
-
owner- or admin-attributed credential
|
|
396
|
-
|
|
416
|
+
owner- or admin-attributed credential, and from the CLI that credential can
|
|
417
|
+
only tighten Guard. Turning Guard off, enforce to assist, a weaker override, and
|
|
418
|
+
removing a stricter override are changed in the dashboard (Settings → Context
|
|
419
|
+
Guard); the CLI prints that link when the server refuses one. `status` and
|
|
420
|
+
`approve` work for every member. All subcommands support `--json`. Guard output uses the same relevance,
|
|
397
421
|
provenance, scope, status, and freshness explanation as `ask`. Every decision,
|
|
398
422
|
including Off, plus confirmations and policy changes is recorded as a
|
|
399
423
|
content-free `guard_check` audit event.
|
|
400
424
|
|
|
401
|
-
## Update the
|
|
425
|
+
## Update the CLI
|
|
402
426
|
|
|
403
427
|
```sh
|
|
404
428
|
lore update
|
|
405
|
-
lore update --version v0.2.
|
|
429
|
+
lore update --version v0.2.28
|
|
406
430
|
```
|
|
407
431
|
|
|
408
432
|
`update` resolves the latest release to an exact tag, or uses the exact
|
|
@@ -421,14 +445,27 @@ every agent recorded in the stored connection: the hooks in files such as
|
|
|
421
445
|
the `lore` MCP server entries next to them, the `@lore-co/opencode` plugin, the
|
|
422
446
|
`lore` skill files, and the hook runtime when an agent needs it. It uses the
|
|
423
447
|
same merge as `connect`, so unchanged files are left alone, changed files
|
|
424
|
-
receive timestamped backups, customer-edited skill files are preserved with
|
|
425
|
-
warning
|
|
426
|
-
|
|
448
|
+
receive timestamped backups, and customer-edited skill files are preserved with
|
|
449
|
+
a warning. The report is by agent and lists only what you need to do:
|
|
450
|
+
|
|
451
|
+
```text
|
|
452
|
+
✓ Lore 0.2.28 is installed
|
|
453
|
+
✓ Updated Lore for Claude Code and Codex
|
|
454
|
+
|
|
455
|
+
Next
|
|
456
|
+
1. Restart your agents.
|
|
457
|
+
2. In Codex, approve Lore's updated hooks with /hooks.
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
When nothing needed refreshing, it says `Your agents are up to date.`
|
|
461
|
+
`lore update --verbose` adds where Lore is installed and each file it
|
|
462
|
+
refreshed or found current. Marks and color appear only on an interactive
|
|
463
|
+
terminal; piped output, `NO_COLOR`, and `TERM=dumb` get plain text.
|
|
427
464
|
Authorization is not repeated and folder rules are untouched; with no stored
|
|
428
465
|
connection, `update` only replaces the binary. The refresh runs in the newly
|
|
429
466
|
installed binary, so the files written, and the ones reported as current, are
|
|
430
|
-
that version's. Updating from 0.2.26
|
|
431
|
-
|
|
467
|
+
that version's. Updating from a release older than 0.2.26, or installing one,
|
|
468
|
+
still needs one `lore connect` afterwards, and `update` says so
|
|
432
469
|
when the refresh can't run.
|
|
433
470
|
|
|
434
471
|
## Inspect or remove
|
|
@@ -565,6 +602,12 @@ command has subcommand-specific `--help`, and `up`, `down`, and `status` support
|
|
|
565
602
|
`down` preserves the PostgreSQL volume. Destructive removal requires both
|
|
566
603
|
`--volumes --yes`.
|
|
567
604
|
|
|
605
|
+
Optional server settings go in `lore.env` in the state directory as
|
|
606
|
+
`KEY=value` lines. `up` keeps keys it does not manage, including across
|
|
607
|
+
`--image-tag` upgrades; keys it manages (ports, origins, secrets) always come
|
|
608
|
+
from its state. Set `EMBEDDING_API_KEY` there: without it, self-hosted search
|
|
609
|
+
is keyword-only and much less relevant.
|
|
610
|
+
|
|
568
611
|
## Runtime behavior
|
|
569
612
|
|
|
570
613
|
Claude Code, Codex, and Cursor also receive the `lore` MCP server, run by this
|
|
@@ -617,10 +660,11 @@ The Claude/Codex/Cursor/Polytoken command-hook handler:
|
|
|
617
660
|
First prompts use `POST /v1/observations` and audited
|
|
618
661
|
`POST /v1/context/deliveries`. Paired turns use `POST /v1/turns` with a
|
|
619
662
|
workspace bearer token and an `Idempotency-Key` header. Automatic teachings
|
|
620
|
-
default to repository scope and follow the workspace learning policy.
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
the dashboard)
|
|
663
|
+
default to repository scope and follow the workspace learning policy. While
|
|
664
|
+
the workspace reviews new learnings (the default), every automatic capture
|
|
665
|
+
remains proposed and cannot be retrieved or injected until it is approved
|
|
666
|
+
(`lore review` or the dashboard) by an owner or admin, or by another member
|
|
667
|
+
when the workspace allows member review. Rejected,
|
|
624
668
|
suppressed, superseded, and deleted learnings are also excluded. Dirty files
|
|
625
669
|
and the current directory remain task relevance evidence and do not narrow
|
|
626
670
|
every learning. Only an explicit correction with clear team-, company,
|
|
@@ -759,7 +803,7 @@ Install Lore-owned Codex and Devin review workflows into the current
|
|
|
759
803
|
repository:
|
|
760
804
|
|
|
761
805
|
```sh
|
|
762
|
-
OPENAI_API_KEY=... DEVIN_API_KEY=... DEVIN_ORG_ID=org-... \
|
|
806
|
+
LORE_INTEGRATION_TOKEN=... OPENAI_API_KEY=... DEVIN_API_KEY=... DEVIN_ORG_ID=org-... \
|
|
763
807
|
lore connect github \
|
|
764
808
|
--repo owner/repository \
|
|
765
809
|
--configure-secrets
|
|
@@ -768,14 +812,17 @@ OPENAI_API_KEY=... DEVIN_API_KEY=... DEVIN_ORG_ID=org-... \
|
|
|
768
812
|
The command overwrites three fixed Lore workflow files and the Lore review
|
|
769
813
|
schema without committing them. Review or back up existing files first.
|
|
770
814
|
`--configure-secrets` requires authenticated `gh` access and updates the named
|
|
771
|
-
Actions secrets and variables in the target repository.
|
|
815
|
+
Actions secrets and variables in the target repository. It stores
|
|
816
|
+
`LORE_INTEGRATION_TOKEN`, an integration token created on the dashboard's
|
|
817
|
+
Connect page, as `LORE_WORKSPACE_TOKEN`; it never copies the
|
|
818
|
+
`lore connect --login` credential, which can review learnings. Codex uses the
|
|
772
819
|
official Codex action. Devin uses a normal v3 session because the dedicated
|
|
773
820
|
Devin Review API cannot accept dynamic Lore context. Reviews run only for
|
|
774
821
|
same-repository, non-draft pull requests bearing the corresponding
|
|
775
822
|
`lore:codex-review` or `lore:devin-review` label.
|
|
776
823
|
|
|
777
824
|
Generated jobs require a published standalone binary release and default to
|
|
778
|
-
`treadiehq/lore-releases` at `v0.2.
|
|
825
|
+
`treadiehq/lore-releases` at `v0.2.28`. Set `LORE_CLI_REPOSITORY` to the publicly
|
|
779
826
|
readable `owner/repository` and `LORE_CLI_VERSION` to an existing release tag
|
|
780
827
|
when using another release source.
|
|
781
828
|
|
package/dist/agents.d.ts
CHANGED
|
@@ -10,6 +10,15 @@ export declare const AGENTS: Record<LaunchableAgent, {
|
|
|
10
10
|
}>;
|
|
11
11
|
export declare const isLaunchable: (value: string) => value is LaunchableAgent;
|
|
12
12
|
export declare const isRecoverySource: (value: string) => value is RecoverySource;
|
|
13
|
+
/**
|
|
14
|
+
* Arguments that start an agent with a handoff brief, which comes from the
|
|
15
|
+
* Lore server, as its prompt and never as an option or subcommand. Checked
|
|
16
|
+
* against each CLI's parser: claude, codex, cursor and devin read everything
|
|
17
|
+
* after `--` as the prompt, but claude and cursor still run a subcommand
|
|
18
|
+
* named by a single word there. opencode and copilot read a following `-x`
|
|
19
|
+
* as a flag, so the brief is attached with `=`. Polytoken's parser could not
|
|
20
|
+
* be checked, so a brief that starts with `-` is refused.
|
|
21
|
+
*/
|
|
13
22
|
export declare function launchArguments(agent: LaunchableAgent, brief: string): string[];
|
|
14
23
|
export declare function findAgentExecutable(agent: LaunchableAgent, env?: NodeJS.ProcessEnv): Promise<string>;
|
|
15
24
|
/** Wrap only installed aliases of this executable; `agent` can belong to another product. */
|
package/dist/agents.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAEA,oFAAoF;AACpF,eAAO,MAAM,iBAAiB,yFAA0F,CAAC;AACzH,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AACjE,eAAO,MAAM,gBAAgB,yFAAoB,CAAC;AAClD,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAC/D,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAQpH,CAAC;AACF,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,KAAG,KAAK,IAAI,eAA2E,CAAC;AAClI,eAAO,MAAM,gBAAgB,GAAI,OAAO,MAAM,KAAG,KAAK,IAAI,cAAyE,CAAC;AAEpI,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAEA,oFAAoF;AACpF,eAAO,MAAM,iBAAiB,yFAA0F,CAAC;AACzH,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AACjE,eAAO,MAAM,gBAAgB,yFAAoB,CAAC;AAClD,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAC/D,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAQpH,CAAC;AACF,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,KAAG,KAAK,IAAI,eAA2E,CAAC;AAClI,eAAO,MAAM,gBAAgB,GAAI,OAAO,MAAM,KAAG,KAAK,IAAI,cAAyE,CAAC;AAEpI;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAU/E;AAED,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,oBAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAMpG;AAED,6FAA6F;AAC7F,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,oBAAc,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAOrG;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,GAAG,OAAO,CAmCrI"}
|
package/dist/agents.js
CHANGED
|
@@ -13,16 +13,29 @@ export const AGENTS = {
|
|
|
13
13
|
};
|
|
14
14
|
export const isLaunchable = (value) => LAUNCHABLE_AGENTS.includes(value);
|
|
15
15
|
export const isRecoverySource = (value) => RECOVERY_SOURCES.includes(value);
|
|
16
|
+
/**
|
|
17
|
+
* Arguments that start an agent with a handoff brief, which comes from the
|
|
18
|
+
* Lore server, as its prompt and never as an option or subcommand. Checked
|
|
19
|
+
* against each CLI's parser: claude, codex, cursor and devin read everything
|
|
20
|
+
* after `--` as the prompt, but claude and cursor still run a subcommand
|
|
21
|
+
* named by a single word there. opencode and copilot read a following `-x`
|
|
22
|
+
* as a flag, so the brief is attached with `=`. Polytoken's parser could not
|
|
23
|
+
* be checked, so a brief that starts with `-` is refused.
|
|
24
|
+
*/
|
|
16
25
|
export function launchArguments(agent, brief) {
|
|
26
|
+
const refuse = (shape) => new Error(`Lore did not start ${AGENTS[agent].label}: the handoff brief looks like ${shape}, not a prompt.`);
|
|
27
|
+
if ((agent === "claude" || agent === "cursor") && /^[^\s-]\S*$/u.test(brief))
|
|
28
|
+
throw refuse("a command name");
|
|
17
29
|
if (agent === "opencode")
|
|
18
|
-
return [
|
|
30
|
+
return [`--prompt=${brief}`];
|
|
19
31
|
if (agent === "copilot-cli")
|
|
20
|
-
return [
|
|
21
|
-
if (agent === "
|
|
22
|
-
|
|
23
|
-
|
|
32
|
+
return [`--interactive=${brief}`];
|
|
33
|
+
if (agent === "polytoken") {
|
|
34
|
+
if (brief.startsWith("-"))
|
|
35
|
+
throw refuse("a command-line option");
|
|
24
36
|
return ["new", "--prompt", brief];
|
|
25
|
-
|
|
37
|
+
}
|
|
38
|
+
return ["--", brief];
|
|
26
39
|
}
|
|
27
40
|
export async function findAgentExecutable(agent, env = process.env) {
|
|
28
41
|
for (const command of AGENTS[agent].commands) {
|
package/dist/agents.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,oFAAoF;AACpF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,U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AE,CAAC;QACzB,MAAM,MAAM,GAAG,CAAC,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC;QAC7I,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACrC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC;YACrB,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC;gBAAE,OAAO,KAAK,CAAC;YACvC,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;gBAAE,CAAC,EAAE,CAAC;QAChC,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/api.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ import type { ZodType } from "zod";
|
|
|
2
2
|
import type { ConnectorConfig } from "./cli.js";
|
|
3
3
|
export declare class LoreApiError extends Error {
|
|
4
4
|
readonly status: number;
|
|
5
|
-
|
|
5
|
+
readonly code?: string | undefined;
|
|
6
|
+
constructor(message: string, status: number, code?: string | undefined);
|
|
6
7
|
}
|
|
7
8
|
/**
|
|
8
9
|
* Minimal authenticated JSON request against the configured Lore API with
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACnC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAIhD,qBAAa,YAAa,SAAQ,KAAK;IACR,QAAQ,CAAC,MAAM,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACnC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAIhD,qBAAa,YAAa,SAAQ,KAAK;IACR,QAAQ,CAAC,MAAM,EAAE,MAAM;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM;gBAAhE,OAAO,EAAE,MAAM,EAAW,MAAM,EAAE,MAAM,EAAW,IAAI,CAAC,EAAE,MAAM,YAAA;CAI7E;AAaD;;;GAGG;AACH,wBAAsB,cAAc,CAAC,CAAC,EACpC,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAClB,IAAI,CAAC,EAAE,OAAO,GACb,OAAO,CAAC,CAAC,CAAC,CAwDZ"}
|
package/dist/api.js
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
const REQUEST_TIMEOUT_MS = 15_000;
|
|
2
2
|
export class LoreApiError extends Error {
|
|
3
3
|
status;
|
|
4
|
-
|
|
4
|
+
code;
|
|
5
|
+
constructor(message, status, code) {
|
|
5
6
|
super(message);
|
|
6
7
|
this.status = status;
|
|
8
|
+
this.code = code;
|
|
7
9
|
this.name = "LoreApiError";
|
|
8
10
|
}
|
|
9
11
|
}
|
|
12
|
+
/** The machine-readable `code` a Lore error body carries, if any. */
|
|
13
|
+
async function errorCode(response) {
|
|
14
|
+
try {
|
|
15
|
+
const parsed = JSON.parse(await response.text());
|
|
16
|
+
const code = typeof parsed === "object" && parsed !== null ? parsed.code : undefined;
|
|
17
|
+
return typeof code === "string" ? code : undefined;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
10
23
|
/**
|
|
11
24
|
* Minimal authenticated JSON request against the configured Lore API with
|
|
12
25
|
* the CLI's standard error language.
|
|
@@ -29,7 +42,7 @@ export async function loreApiRequest(config, method, path, schema, body) {
|
|
|
29
42
|
throw new Error("Lore API is unreachable. Run lore doctor to diagnose connectivity.");
|
|
30
43
|
}
|
|
31
44
|
if (response.status === 401 || response.status === 403) {
|
|
32
|
-
throw new LoreApiError("Lore authentication failed. Reconnect with a valid workspace token.", response.status);
|
|
45
|
+
throw new LoreApiError("Lore authentication failed. Reconnect with a valid workspace token.", response.status, await errorCode(response));
|
|
33
46
|
}
|
|
34
47
|
if (response.status === 404) {
|
|
35
48
|
const text = await response.text();
|
package/dist/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAGA,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC,MAAM,OAAO,YAAa,SAAQ,KAAK;IACC;
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAGA,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC,MAAM,OAAO,YAAa,SAAQ,KAAK;IACC;IAAyB;IAA/D,YAAY,OAAe,EAAW,MAAc,EAAW,IAAa;QAC1E,KAAK,CAAC,OAAO,CAAC,CAAC;QADqB,WAAM,GAAN,MAAM,CAAQ;QAAW,SAAI,GAAJ,IAAI,CAAS;QAE1E,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAED,qEAAqE;AACrE,KAAK,UAAU,SAAS,CAAC,QAAkB;IACzC,IAAI,CAAC;QACH,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QAC1D,MAAM,IAAI,GAAG,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,CAAC,CAAC,CAAE,MAA6B,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;QAC7G,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,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,CAAC;QAChC,IAAI,CAAC;YACH,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACzC,IACE,OAAO,MAAM,KAAK,QAAQ;gBAC1B,MAAM,KAAK,IAAI;gBACf,OAAQ,MAAgC,CAAC,OAAO,KAAK,QAAQ,EAC7D,CAAC;gBACD,OAAO,GAAI,MAA8B,CAAC,OAAO,CAAC;YACpD,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,2DAA2D;QAC7D,CAAC;QACD,MAAM,IAAI,YAAY,CACpB,OAAO;YACL,qCAAqC,MAAM,IAAI,IAAI,uBAAuB,EAC5E,QAAQ,CAAC,MAAM,CAChB,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,iCAAiC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IACvE,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACnE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,4EAA4E,CAC7E,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC"}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/** A request to save the current work as a reusable approach starts the save workflow. */
|
|
2
|
+
export declare function approachWorkflowRequested(prompt: string): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* `workflowStarted` is true once this session asked to save an approach, so a
|
|
5
|
+
* continuation such as "go ahead and save it" after compaction still gets the
|
|
6
|
+
* detailed instructions back.
|
|
7
|
+
*/
|
|
8
|
+
export declare function approachGuidance(prompt: string, agent: string, sessionId: string, retained?: readonly string[], workflowStarted?: boolean): string | undefined;
|
|
2
9
|
//# sourceMappingURL=approach-guidance.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approach-guidance.d.ts","sourceRoot":"","sources":["../src/approach-guidance.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,GAAE,SAAS,MAAM,EAAO,GAAG,MAAM,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"approach-guidance.d.ts","sourceRoot":"","sources":["../src/approach-guidance.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEjE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,GAAE,SAAS,MAAM,EAAO,EAAE,eAAe,UAAQ,GAAG,MAAM,GAAG,SAAS,CAmBhK"}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
/** A request to save the current work as a reusable approach starts the save workflow. */
|
|
2
|
+
export function approachWorkflowRequested(prompt) {
|
|
3
|
+
return /\bmake (?:this|that|it|the work) repeatable\b|\b(?:saved|reusable) approach\b/iu.test(prompt);
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* `workflowStarted` is true once this session asked to save an approach, so a
|
|
7
|
+
* continuation such as "go ahead and save it" after compaction still gets the
|
|
8
|
+
* detailed instructions back.
|
|
9
|
+
*/
|
|
10
|
+
export function approachGuidance(prompt, agent, sessionId, retained = [], workflowStarted = false) {
|
|
2
11
|
// A capability cue lets the agent recognize ordinary requests itself. Reuse
|
|
3
12
|
// must not depend on the user knowing a feature name or a trigger phrase.
|
|
4
13
|
const discovery = `Lore can save and reuse reviewed approaches in Learnings. If the user asks to repeat earlier work or do it the way it was done before, list active approaches in this repository and choose by the task, without requiring an exact name. Prefer the Lore MCP tools when your host offers them (search_approaches, get_approach, use_approach, report_approach_run, decide_approach_run); they record the run without a shell command. Otherwise run \`lore approach --help\` and pass each request through \`--input <file>\` from a temporary JSON file; never pipe approach JSON inline or put its free-text values on the command line. Infer inputs from the request and repository; ask only for missing information or an ambiguous match. Use the saved version, check prerequisites before editing, and record the actual result. Your native session is ${JSON.stringify({ agent, sessionId })}.`;
|
|
5
|
-
const detailed =
|
|
14
|
+
const detailed = workflowStarted || approachWorkflowRequested(prompt);
|
|
6
15
|
const instructions = ["Prefer the Lore MCP approach tools when your host offers them; prepare_approach, draft_approach, and save_approach carry the same contract as the CLI operations. Otherwise run `lore approach --help` for the JSON command contract, write each request to a temporary JSON file, and pass its path with `--input`; do not pipe the JSON inline, so summaries, notes, and other free text stay off the command line. Both paths use this folder's existing connection.",
|
|
7
16
|
`For source preparation, use an explicit Lore source session if the user supplied one. Otherwise your native session reference is ${JSON.stringify({ externalSessionId: sessionId, agent })}. Resolve it with prepare; never invent a Lore session UUID. If it is not captured yet, use explicit source notes and describe missing evidence.`,
|
|
8
17
|
"For saving: prepare the source, preserve human corrections, show the name, inputs, steps, prerequisites, and checks, then keep a draft. Save only after the user reviews and asks to save. Missing final work or checks must stay a draft. Agent saves are proposals and need owner or admin approval in Learnings before reuse.",
|
|
@@ -12,7 +21,8 @@ export function approachGuidance(prompt, agent, sessionId, retained = []) {
|
|
|
12
21
|
"For reuse: list active approaches in this repository, choose by the task without requiring an exact name, infer the inputs from the request and repository, and use its exact version. Ask only when information is missing or the match is ambiguous. Check prerequisites before editing. Changed or unknown prerequisites require needs_input and a specific user decision. Execute with your normal tools and permissions, report actual artifacts/checks, and keep missing evidence unknown. Updating the shared approach is a separate reviewed revision.",
|
|
13
22
|
].join("\n");
|
|
14
23
|
// Confirm each complete part in the host's current context. New workflow
|
|
15
|
-
// instructions still go out after discovery; compaction restores both
|
|
24
|
+
// instructions still go out after discovery; compaction restores both, and
|
|
25
|
+
// the instructions too once the session has started saving an approach.
|
|
16
26
|
return [discovery, ...(detailed ? [instructions] : [])]
|
|
17
27
|
.filter(part => !retained.some(text => text.includes(part)))
|
|
18
28
|
.join("\n\n") || undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approach-guidance.js","sourceRoot":"","sources":["../src/approach-guidance.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,gBAAgB,CAAC,MAAc,EAAE,KAAa,EAAE,SAAiB,EAAE,WAA8B,EAAE;
|
|
1
|
+
{"version":3,"file":"approach-guidance.js","sourceRoot":"","sources":["../src/approach-guidance.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,MAAM,UAAU,yBAAyB,CAAC,MAAc;IACtD,OAAO,iFAAiF,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACxG,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAc,EAAE,KAAa,EAAE,SAAiB,EAAE,WAA8B,EAAE,EAAE,eAAe,GAAG,KAAK;IAC1I,4EAA4E;IAC5E,0EAA0E;IAC1E,MAAM,SAAS,GAAG,q0BAAq0B,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,GAAG,CAAC;IAC/3B,MAAM,QAAQ,GAAG,eAAe,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAAC;IACtE,MAAM,YAAY,GAAG,CAAC,ycAAyc;QAC7d,oIAAoI,IAAI,CAAC,SAAS,CAAC,EAAE,iBAAiB,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,kJAAkJ;QAC7U,kUAAkU;QAClU,4aAA4a;QAC5a,irBAAirB;QACjrB,4QAA4Q;QAC5Q,giBAAgiB;KACjiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACb,yEAAyE;IACzE,2EAA2E;IAC3E,wEAAwE;IACxE,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SACpD,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;SAC3D,IAAI,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC;AAC/B,CAAC"}
|
package/dist/approach.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approach.d.ts","sourceRoot":"","sources":["../src/approach.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"approach.d.ts","sourceRoot":"","sources":["../src/approach.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAwB,MAAM,cAAc,CAAC;AAEhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAIhD,eAAO,MAAM,aAAa,62HA0DzB,CAAC;AAEF,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,EAAE,eAAe,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAqB/G;AAED,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CA0BlJ"}
|
package/dist/approach.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { open } from "node:fs/promises";
|
|
2
1
|
import { constants } from "node:fs";
|
|
3
2
|
import { LoreClient, SharedMemoryApiError } from "@lore-co/sdk";
|
|
4
3
|
import { z } from "zod";
|
|
5
4
|
import { repositoryScopeFromDirectory } from "@lore-co/core/repository-location";
|
|
5
|
+
import { openNoFollow } from "@lore-co/core/no-follow";
|
|
6
6
|
export const APPROACH_HELP = `lore approach — save and reuse a reviewed way of working
|
|
7
7
|
|
|
8
8
|
Usage: lore approach <operation> --input <JSON-file|->
|
|
@@ -81,7 +81,7 @@ export async function runApproachCommand(args, config) {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
else {
|
|
84
|
-
const file = await
|
|
84
|
+
const file = await openNoFollow(path, constants.O_RDONLY);
|
|
85
85
|
try {
|
|
86
86
|
const stat = await file.stat();
|
|
87
87
|
if (!stat.isFile() || stat.size > 256000)
|
package/dist/approach.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approach.js","sourceRoot":"","sources":["../src/approach.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"approach.js","sourceRoot":"","sources":["../src/approach.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0D5B,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,IAAuB,EAAE,MAA8B;IAC9F,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QAAC,OAAO;IAAC,CAAC;IACpG,MAAM,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC;IACrC,IAAI,CAAC,SAAS,IAAI,I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oD,CAAC,CAAC;QAC9G,KAAK,MAAM,CAAC,CAAC,OAAO,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,KAAkD,CAAC,CAAC;QACxG,KAAK,KAAK,CAAC,CAAC,OAAO,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,KAAK,EAAmD,CAAC,CAAC;QAC5H,KAAK,QAAQ,CAAC,CAAC,OAAO,MAAM,CAAC,iBAAiB,CAAC,QAAQ,EAAE,EAAE,KAAuD,CAAC,CAAC;QACpH,KAAK,QAAQ,CAAC,CAAC,OAAO,MAAM,CAAC,iBAAiB,CAAC,QAAQ,EAAE,EAAE,KAAuD,CAAC,CAAC;QACpH,KAAK,MAAM,CAAC,CAAC,OAAO,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,CAAC;QACxD,OAAO,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IACpF,CAAC;AACH,CAAC"}
|
package/dist/ask.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ask.d.ts","sourceRoot":"","sources":["../src/ask.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ask.d.ts","sourceRoot":"","sources":["../src/ask.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,2BAA2B,IAAI,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACpG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAkJ5B,wBAAsB,aAAa,CACjC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,MAAM,EAAE,eAAe,GAAG,IAAI,EAC9B,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAC7B,OAAO,CAAC,IAAI,CAAC,CAiEf"}
|
package/dist/ask.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AskResponseSchema, formatRetrievalExplanation, } from "@lore-co/core";
|
|
1
|
+
import { AskResponseSchema, formatRetrievalExplanation, showControlCharacters, } from "@lore-co/core";
|
|
2
2
|
import { repositoryScopeFromCheckout as detectRepository } from "@lore-co/core/repository-location";
|
|
3
3
|
// The repository the capture hooks record for this folder, or none outside a checkout.
|
|
4
4
|
export { detectRepository };
|
|
@@ -178,6 +178,6 @@ export async function runAskCommand(args, config, options = {}) {
|
|
|
178
178
|
process.stdout.write(`${JSON.stringify(parsedResponse.data, null, 2)}\n`);
|
|
179
179
|
return;
|
|
180
180
|
}
|
|
181
|
-
process.stdout.write(`${formatRepositoryLine(repo, repoSource)}\n${formatResponse(parsedResponse.data)}`);
|
|
181
|
+
process.stdout.write(showControlCharacters(`${formatRepositoryLine(repo, repoSource)}\n${formatResponse(parsedResponse.data)}`));
|
|
182
182
|
}
|
|
183
183
|
//# sourceMappingURL=ask.js.map
|
package/dist/ask.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ask.js","sourceRoot":"","sources":["../src/ask.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,0BAA0B,
|
|
1
|
+
{"version":3,"file":"ask.js","sourceRoot":"","sources":["../src/ask.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,qBAAqB,GAGtB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,2BAA2B,IAAI,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAGpG,uFAAuF;AACvF,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;CAoBhB,CAAC;AAYF,SAAS,iBAAiB,CAAC,IAAuB;IAChD,MAAM,MAAM,GAAiB;QAC3B,QAAQ,EAAE,EAAE;QACZ,eAAe,EAAE,IAAI;QACrB,IAAI,EAAE,KAAK;KACZ,CAAC;IACF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J,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CACb,4EAA4E,CAC7E,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,6BAA6B,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IACnE,CAAC;IACD,MAAM,cAAc,GAAG,iBAAiB,CAAC,SAAS,CAChD,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAClC,CAAC;IACF,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CACb,gFAAgF,CACjF,CAAC;IACJ,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QAChB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QAC1E,OAAO;IACT,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,qBAAqB,CAAC,GAAG,oBAAoB,CAAC,IAAI,EAAE,UAAU,CAAC,KAAK,cAAc,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAC3G,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ConnectorConfig } from "./cli.js";
|
|
2
|
+
export declare const CAPTURE_REPAIR_HELP = "lore capture repair\nRetry captures that died while the extraction provider was down.\n\nUsage:\n lore capture repair [--json]\n\nOptions:\n --json Print machine-readable output\n --help Show this help\n\nA capture gets five extraction attempts. When the extraction provider is down\nor rate limited for longer than that, Lore dead-letters the capture and lore\ndoctor reports a server-operational-metrics error. Once the provider is back,\nrun this command to give those captures a fresh set of attempts. Captures that\nfailed for a permanent reason (invalid data, a rejected request or key) stay\ndead. Requires a workspace owner or admin connected with lore connect --login.\n\nCounts:\n rearmed dead captures queued for extraction again\n skipped dead captures with a permanent failure, left dead\n remaining retryable dead captures not queued because the workspace already\n has CAPTURE_PENDING_JOB_LIMIT captures waiting; run again later\n\nExamples:\n lore capture repair\n lore capture repair --json\n";
|
|
3
|
+
export interface CaptureRepairSummary {
|
|
4
|
+
workspaceId: string;
|
|
5
|
+
rearmed: number;
|
|
6
|
+
skipped: number;
|
|
7
|
+
remaining: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function captureRepairText(summary: CaptureRepairSummary): string;
|
|
10
|
+
export declare function runCaptureRepairCommand(args: readonly string[], config: ConnectorConfig | null): Promise<void>;
|
|
11
|
+
//# sourceMappingURL=capture-repair.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-repair.d.ts","sourceRoot":"","sources":["../src/capture-repair.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,eAAO,MAAM,mBAAmB,yhCA0B/B,CAAC;AAMF,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAevE;AAED,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,MAAM,EAAE,eAAe,GAAG,IAAI,GAC7B,OAAO,CAAC,IAAI,CAAC,CAoDf"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { CAPTURE_REPAIR_REQUIRES_ADMIN, CaptureRepairResponseSchema, } from "@lore-co/core";
|
|
2
|
+
import { LoreApiError, loreApiRequest } from "./api.js";
|
|
3
|
+
export const CAPTURE_REPAIR_HELP = `lore capture repair
|
|
4
|
+
Retry captures that died while the extraction provider was down.
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
lore capture repair [--json]
|
|
8
|
+
|
|
9
|
+
Options:
|
|
10
|
+
--json Print machine-readable output
|
|
11
|
+
--help Show this help
|
|
12
|
+
|
|
13
|
+
A capture gets five extraction attempts. When the extraction provider is down
|
|
14
|
+
or rate limited for longer than that, Lore dead-letters the capture and lore
|
|
15
|
+
doctor reports a server-operational-metrics error. Once the provider is back,
|
|
16
|
+
run this command to give those captures a fresh set of attempts. Captures that
|
|
17
|
+
failed for a permanent reason (invalid data, a rejected request or key) stay
|
|
18
|
+
dead. Requires a workspace owner or admin connected with lore connect --login.
|
|
19
|
+
|
|
20
|
+
Counts:
|
|
21
|
+
rearmed dead captures queued for extraction again
|
|
22
|
+
skipped dead captures with a permanent failure, left dead
|
|
23
|
+
remaining retryable dead captures not queued because the workspace already
|
|
24
|
+
has CAPTURE_PENDING_JOB_LIMIT captures waiting; run again later
|
|
25
|
+
|
|
26
|
+
Examples:
|
|
27
|
+
lore capture repair
|
|
28
|
+
lore capture repair --json
|
|
29
|
+
`;
|
|
30
|
+
const USAGE = "Usage: lore capture repair [--json]";
|
|
31
|
+
/** Upper bound on calls, so a misbehaving server cannot loop forever. */
|
|
32
|
+
const MAX_PAGES = 1_000;
|
|
33
|
+
export function captureRepairText(summary) {
|
|
34
|
+
const counts = `rearmed: ${summary.rearmed}\nskipped: ${summary.skipped}\nremaining: ${summary.remaining}\n`;
|
|
35
|
+
const later = summary.remaining > 0
|
|
36
|
+
? ` ${summary.remaining} more wait for room in the capture backlog; run lore capture repair again once these finish.`
|
|
37
|
+
: "";
|
|
38
|
+
if (summary.rearmed > 0) {
|
|
39
|
+
return `${counts}Queued ${summary.rearmed} dead capture(s) for extraction again.${later} Run lore doctor after they finish; the dead-letter error clears once they succeed.\n`;
|
|
40
|
+
}
|
|
41
|
+
if (summary.remaining > 0) {
|
|
42
|
+
return `${counts}The capture backlog is full, so no dead capture was queued. Run lore capture repair again once pending captures finish.\n`;
|
|
43
|
+
}
|
|
44
|
+
if (summary.skipped > 0) {
|
|
45
|
+
return `${counts}No dead capture could be retried. Skipped captures failed for a permanent reason, such as invalid data or a rejected request.\n`;
|
|
46
|
+
}
|
|
47
|
+
return `${counts}No dead captures needed repair.\n`;
|
|
48
|
+
}
|
|
49
|
+
export async function runCaptureRepairCommand(args, config) {
|
|
50
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
51
|
+
process.stdout.write(CAPTURE_REPAIR_HELP);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
let json = false;
|
|
55
|
+
for (const flag of args) {
|
|
56
|
+
if (flag === "--json") {
|
|
57
|
+
json = true;
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
throw new Error(`Unknown capture repair option: ${flag}\n${USAGE}`);
|
|
61
|
+
}
|
|
62
|
+
if (!config) {
|
|
63
|
+
throw new Error("Lore is not connected. Run: lore connect --login");
|
|
64
|
+
}
|
|
65
|
+
let rearmed = 0;
|
|
66
|
+
let last = null;
|
|
67
|
+
for (let page = 0; page < MAX_PAGES; page += 1) {
|
|
68
|
+
try {
|
|
69
|
+
last = await loreApiRequest(config, "POST", "/v1/reliability/captures/repair", CaptureRepairResponseSchema, {});
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
if (error instanceof LoreApiError && error.status === 403 && error.code === CAPTURE_REPAIR_REQUIRES_ADMIN) {
|
|
73
|
+
throw new Error("Only a workspace owner or admin can retry dead captures. Ask one to run lore capture repair, or connect as one with lore connect --login.");
|
|
74
|
+
}
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
77
|
+
rearmed += last.rearmed;
|
|
78
|
+
// Stop once nothing is left or the backlog cap stopped this call.
|
|
79
|
+
if (last.remaining === 0 || last.rearmed === 0) {
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (last === null) {
|
|
84
|
+
throw new Error("Lore did not finish repairing captures. Run lore capture repair again.");
|
|
85
|
+
}
|
|
86
|
+
const summary = {
|
|
87
|
+
workspaceId: last.workspaceId,
|
|
88
|
+
rearmed,
|
|
89
|
+
skipped: last.skipped,
|
|
90
|
+
remaining: last.remaining,
|
|
91
|
+
};
|
|
92
|
+
process.stdout.write(json ? `${JSON.stringify(summary, null, 2)}\n` : captureRepairText(summary));
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=capture-repair.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-repair.js","sourceRoot":"","sources":["../src/capture-repair.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,2BAA2B,GAE5B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAGxD,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BlC,CAAC;AAEF,MAAM,KAAK,GAAG,qCAAqC,CAAC;AACpD,yEAAyE;AACzE,MAAM,SAAS,GAAG,KAAK,CAAC;AASxB,MAAM,UAAU,iBAAiB,CAAC,OAA6B;IAC7D,MAAM,MAAM,GAAG,YAAY,OAAO,CAAC,OAAO,cAAc,OAAO,CAAC,OAAO,gBAAgB,OAAO,CAAC,SAAS,IAAI,CAAC;IAC7G,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,GAAG,CAAC;QACjC,CAAC,CAAC,IAAI,OAAO,CAAC,SAAS,8FAA8F;QACrH,CAAC,CAAC,EAAE,CAAC;IACP,IAAI,OAAO,CAAC,OAAO,GAAG,CAAC,EAAE,CAAC;QACxB,OAAO,GAAG,MAAM,UAAU,OAAO,CAAC,OAAO,yCAAyC,KAAK,uFAAuF,CAAC;IACjL,CAAC;IACD,IAAI,OAAO,CAAC,SAAS,GAAG,CAAC,EAAE,CAAC;QAC1B,OAAO,GAAG,MAAM,2HAA2H,CAAC;IAC9I,CAAC;IACD,IAAI,OAAO,C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,CAAC,2IAA2I,CAAC,CAAC;YAC/J,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;QACD,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC;QACxB,kEAAkE;QAClE,IAAI,IAAI,CAAC,SAAS,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,KAAK,CAAC,EAAE,CAAC;YAC/C,MAAM;QACR,CAAC;IACH,CAAC;IACD,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAC;IAC5F,CAAC;IACD,MAAM,OAAO,GAAyB;QACpC,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,OAAO;QACP,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,SAAS,EAAE,IAAI,CAAC,SAAS;KAC1B,CAAC;IACF,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAC5E,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capture-scope.d.ts","sourceRoot":"","sources":["../src/capture-scope.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"capture-scope.d.ts","sourceRoot":"","sources":["../src/capture-scope.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,WAAW,mBAAmB;IAAG,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE;AAEhH,gFAAgF;AAChF,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,SAAgB,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,GAAG,SAAS,CAAC,CAgBpJ;AAID,mFAAmF;AACnF,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAIhF;AAED,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI/F"}
|