@lore-co/cli 0.1.28 → 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.
- package/README.md +44 -9
- package/dist/agents.d.ts +3 -1
- package/dist/agents.d.ts.map +1 -1
- package/dist/agents.js +31 -7
- package/dist/agents.js.map +1 -1
- package/dist/cli.d.ts +8 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +97 -15
- package/dist/cli.js.map +1 -1
- package/dist/command-help.d.ts +2 -1
- package/dist/command-help.d.ts.map +1 -1
- package/dist/command-help.js +33 -6
- package/dist/command-help.js.map +1 -1
- package/dist/generated-assets.d.ts +9 -4
- package/dist/generated-assets.d.ts.map +1 -1
- package/dist/generated-assets.js +5 -4
- package/dist/generated-assets.js.map +1 -1
- package/dist/recovery-cloud-workspace.d.ts +11 -0
- package/dist/recovery-cloud-workspace.d.ts.map +1 -0
- package/dist/recovery-cloud-workspace.js +113 -0
- package/dist/recovery-cloud-workspace.js.map +1 -0
- package/dist/recovery-cloud.d.ts +31 -0
- package/dist/recovery-cloud.d.ts.map +1 -0
- package/dist/recovery-cloud.js +242 -0
- package/dist/recovery-cloud.js.map +1 -0
- package/dist/recovery-codex.d.ts +5 -0
- package/dist/recovery-codex.d.ts.map +1 -0
- package/dist/recovery-codex.js +111 -0
- package/dist/recovery-codex.js.map +1 -0
- package/dist/recovery-copilot.d.ts +14 -0
- package/dist/recovery-copilot.d.ts.map +1 -0
- package/dist/recovery-copilot.js +120 -0
- package/dist/recovery-copilot.js.map +1 -0
- package/dist/recovery-desktop.d.ts +7 -0
- package/dist/recovery-desktop.d.ts.map +1 -0
- package/dist/recovery-desktop.js +179 -0
- package/dist/recovery-desktop.js.map +1 -0
- package/dist/recovery-external.d.ts +61 -0
- package/dist/recovery-external.d.ts.map +1 -0
- package/dist/recovery-external.js +98 -0
- package/dist/recovery-external.js.map +1 -0
- package/dist/recovery-hooks.d.ts +5 -0
- package/dist/recovery-hooks.d.ts.map +1 -0
- package/dist/recovery-hooks.js +115 -0
- package/dist/recovery-hooks.js.map +1 -0
- package/dist/recovery-hosts.d.ts +13 -0
- package/dist/recovery-hosts.d.ts.map +1 -0
- package/dist/recovery-hosts.js +263 -0
- package/dist/recovery-hosts.js.map +1 -0
- package/dist/recovery-polytoken.d.ts +14 -0
- package/dist/recovery-polytoken.d.ts.map +1 -0
- package/dist/recovery-polytoken.js +194 -0
- package/dist/recovery-polytoken.js.map +1 -0
- package/dist/recovery-remote.d.ts +8 -0
- package/dist/recovery-remote.d.ts.map +1 -0
- package/dist/recovery-remote.js +135 -0
- package/dist/recovery-remote.js.map +1 -0
- package/dist/recovery-state.d.ts +25 -1
- package/dist/recovery-state.d.ts.map +1 -1
- package/dist/recovery-state.js +69 -15
- package/dist/recovery-state.js.map +1 -1
- package/dist/recovery-t3.d.ts +17 -0
- package/dist/recovery-t3.d.ts.map +1 -0
- package/dist/recovery-t3.js +58 -0
- package/dist/recovery-t3.js.map +1 -0
- package/dist/recovery-transfer.d.ts +22 -0
- package/dist/recovery-transfer.d.ts.map +1 -0
- package/dist/recovery-transfer.js +228 -0
- package/dist/recovery-transfer.js.map +1 -0
- package/dist/recovery.d.ts +9 -1
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +187 -47
- package/dist/recovery.js.map +1 -1
- package/dist/self-host.d.ts +1 -1
- package/dist/self-host.js +2 -2
- package/dist/uninstall.d.ts +19 -0
- package/dist/uninstall.d.ts.map +1 -0
- package/dist/uninstall.js +128 -0
- package/dist/uninstall.js.map +1 -0
- package/dist/update.js +3 -3
- package/package.json +3 -3
package/dist/command-help.js
CHANGED
|
@@ -11,6 +11,7 @@ export const COMMAND_GUIDES = {
|
|
|
11
11
|
doctor: "Find the cause when capture, context delivery, or an agent integration is not working.",
|
|
12
12
|
update: "Install the latest published CLI binary.",
|
|
13
13
|
disconnect: "Stop this machine's Lore integrations and remove its local credentials.",
|
|
14
|
+
uninstall: "Disconnect this machine and remove the Lore CLI while keeping shared knowledge and local recordings.",
|
|
14
15
|
"self-host": "Run Lore on infrastructure you control, with persistent data managed by Docker Compose.",
|
|
15
16
|
run: "Start a local coding agent through Lore with any configured recovery route.",
|
|
16
17
|
recovery: "Choose a fallback agent and inspect or give feedback on recovery attempts.",
|
|
@@ -41,6 +42,7 @@ Workspace and setup:
|
|
|
41
42
|
doctor Diagnose missing capture, context, or connections
|
|
42
43
|
update Install the latest CLI binary
|
|
43
44
|
disconnect Remove this machine's integrations and credentials
|
|
45
|
+
uninstall Disconnect this machine and remove the CLI
|
|
44
46
|
self-host Start, inspect, or stop your own Lore server
|
|
45
47
|
|
|
46
48
|
Additional workflows:
|
|
@@ -89,11 +91,13 @@ Example setup:
|
|
|
89
91
|
lore connect github --repo acme/app
|
|
90
92
|
`;
|
|
91
93
|
const recoveryHelp = `lore recovery
|
|
92
|
-
Configure and inspect local agent recovery.
|
|
94
|
+
Configure and inspect local and remote agent recovery.
|
|
93
95
|
|
|
94
96
|
Commands:
|
|
95
97
|
agents List supported and installed agents
|
|
96
98
|
enable --from <agent> --to <agent> Configure a fallback route
|
|
99
|
+
cloud runner --name <name> Pair a desktop or SSH receiver for hosted cloud offers
|
|
100
|
+
cloud status | off Inspect or disconnect cloud recovery
|
|
97
101
|
status Show routes and recovery metrics
|
|
98
102
|
brief <run-id> Print saved context for a recovery attempt
|
|
99
103
|
feedback <run-id> useful|not-useful Record whether an attempt helped
|
|
@@ -102,15 +106,38 @@ Commands:
|
|
|
102
106
|
Examples:
|
|
103
107
|
lore recovery agents
|
|
104
108
|
lore recovery enable --from claude --to codex
|
|
109
|
+
lore recovery enable --from cursor --to codex --ssh worker --directory /srv/repo
|
|
105
110
|
lore recovery status
|
|
106
111
|
lore recovery brief <run-id>
|
|
107
112
|
lore recovery off
|
|
108
113
|
|
|
109
|
-
|
|
110
|
-
|
|
114
|
+
Connect enables recovery when two supported clients are installed. Native Codex
|
|
115
|
+
hooks require review in /hooks. Remote destinations need SSH, Lore, an authenticated
|
|
116
|
+
agent, and a repository containing the source HEAD. Open a new terminal after
|
|
117
|
+
setup. Automatic recovery support varies by host; see docs/recovery.md.
|
|
111
118
|
`;
|
|
112
119
|
/** Help for commands that do not have a dedicated argument-parser help path. */
|
|
113
120
|
export const HELP_OVERRIDES = {
|
|
121
|
+
"recovery cloud": `lore recovery cloud
|
|
122
|
+
Connect hosted cloud recovery to a local or SSH destination.
|
|
123
|
+
|
|
124
|
+
Commands:
|
|
125
|
+
runner --name <name> [--agent <tool>] Pair the current GitHub checkout once
|
|
126
|
+
--ssh <user@host> --directory <path> Use an authenticated SSH worker
|
|
127
|
+
status Inspect local runner connectivity
|
|
128
|
+
off Unpair this machine's cloud runners
|
|
129
|
+
source --api-url <url> --job <id> Export a paired cloud workspace on failure
|
|
130
|
+
receive --api-url <url> --offer <id> Restore and verify an accepted snapshot
|
|
131
|
+
|
|
132
|
+
Configure Devin/Cursor provider connections and watched jobs in the hosted
|
|
133
|
+
Recovery page. A stopped job opens an offer; dashboard acceptance launches the
|
|
134
|
+
selected tool. Pair a source workspace in Recovery and run source inside its VM
|
|
135
|
+
with LORE_CLOUD_SOURCE_TOKEN set. Exports include Git history and eligible dirty
|
|
136
|
+
files, up to 8 MiB; receivers verify file hashes. Without an exporter, only the
|
|
137
|
+
pushed checkpoint is available and requires explicit acknowledgement.
|
|
138
|
+
Managed receivers need this CLI installed and use LORE_CLOUD_RECEIVE_TOKEN.
|
|
139
|
+
No paid destination starts during pairing.
|
|
140
|
+
`,
|
|
114
141
|
"connect github": `lore connect github
|
|
115
142
|
Install Lore's GitHub Actions review and correction workflows in a repository.
|
|
116
143
|
|
|
@@ -177,7 +204,7 @@ Starts a cloud session, waits for its review, saves the result, and archives the
|
|
|
177
204
|
export const HELP_SUBCOMMANDS = {
|
|
178
205
|
connect: ["github"],
|
|
179
206
|
guard: ["status", "off", "assist", "enforce", "approve", "break-glass", "clear-override"],
|
|
180
|
-
recovery: ["agents", "enable", "status", "off", "brief", "feedback"],
|
|
207
|
+
recovery: ["cloud", "agents", "enable", "status", "off", "brief", "feedback"],
|
|
181
208
|
github: ["prepare-review", "post-review", "observe-correction"],
|
|
182
209
|
devin: ["cli", "setup", "start", "prompt", "status", "run-review", "terminate"],
|
|
183
210
|
host: ["deliver", "observe", "turn"],
|
|
@@ -189,12 +216,12 @@ export function helpTopic(args) {
|
|
|
189
216
|
throw new Error(`Unknown help topic: ${command ?? ""}\nTry: lore help`);
|
|
190
217
|
if (subcommand !== undefined && !HELP_SUBCOMMANDS[command]?.includes(subcommand))
|
|
191
218
|
throw new Error(`Unknown help topic: ${args.join(" ")}\nTry: lore help ${command}`);
|
|
192
|
-
if (args.length > 2 && !(args.length === 3 && command === "devin" && subcommand === "cli" && ["setup", "status", "sync", "off"].includes(args[2])))
|
|
219
|
+
if (args.length > 2 && !(args.length === 3 && ((command === "devin" && subcommand === "cli" && ["setup", "status", "sync", "off"].includes(args[2])) || (command === "recovery" && subcommand === "cloud" && ["runner", "source", "receive", "status", "off"].includes(args[2])))))
|
|
193
220
|
throw new Error("Usage: lore help [command] [subcommand]");
|
|
194
221
|
return {
|
|
195
222
|
command: command,
|
|
196
223
|
subcommand,
|
|
197
|
-
text: HELP_OVERRIDES[args.join(" ")] ?? HELP_OVERRIDES[command],
|
|
224
|
+
text: HELP_OVERRIDES[args.join(" ")] ?? HELP_OVERRIDES[args.slice(0, 2).join(" ")] ?? HELP_OVERRIDES[command],
|
|
198
225
|
};
|
|
199
226
|
}
|
|
200
227
|
//# sourceMappingURL=command-help.js.map
|
package/dist/command-help.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-help.js","sourceRoot":"","sources":["../src/command-help.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,OAAO,EAAE,gFAAgF;IACzF,GAAG,EAAE,+EAA+E;IACpF,QAAQ,EAAE,kGAAkG;IAC5G,KAAK,EAAE,4EAA4E;IACnF,MAAM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are const GITHUB_TEMPLATE_ASSETS: {
|
|
2
|
-
readonly "lore-codex-review.yml": "name: Lore Codex review\nrun-name: \"Lore Codex review [${{ github.event.action }}] PR #${{ github.event.pull_request.number }} @ ${{ github.event.pull_request.head.sha }}\"\n\non:\n pull_request:\n types: [opened, synchronize, reopened, ready_for_review, labeled]\n\njobs:\n review:\n if: >-\n !github.event.pull_request.draft &&\n github.event.pull_request.head.repo.full_name == github.repository &&\n contains(github.event.pull_request.labels.*.name, 'lore:codex-review')\n runs-on: ubuntu-latest\n permissions:\n contents: read\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore-releases' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.
|
|
3
|
-
readonly "lore-devin-review.yml": "name: Lore Devin review\nrun-name: \"Lore Devin review [${{ github.event.action }}] PR #${{ github.event.pull_request.number }} @ ${{ github.event.pull_request.head.sha }}\"\n\non:\n pull_request:\n types: [opened, synchronize, reopened, ready_for_review, labeled]\n\nconcurrency:\n group: lore-devin-review-${{ github.repository }}-${{ github.event.pull_request.number }}\n cancel-in-progress: true\n\njobs:\n review:\n if: >-\n !github.event.pull_request.draft &&\n github.event.pull_request.head.repo.full_name == github.repository &&\n contains(github.event.pull_request.labels.*.name, 'lore:devin-review')\n runs-on: ubuntu-latest\n permissions:\n contents: read\n pull-requests: write\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore-releases' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.
|
|
4
|
-
readonly "lore-observe-correction.yml": "name: Lore review correction\nrun-name: \"Lore review correction comment #${{ github.event.comment.id }}\"\n\non:\n issue_comment:\n types: [created]\n\njobs:\n observe:\n if: >-\n github.event.issue.pull_request &&\n startsWith(github.event.comment.body, '/lore correct ')\n runs-on: ubuntu-latest\n permissions:\n contents: read\n issues: read\n pull-requests: read\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore-releases' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.
|
|
2
|
+
readonly "lore-codex-review.yml": "name: Lore Codex review\nrun-name: \"Lore Codex review [${{ github.event.action }}] PR #${{ github.event.pull_request.number }} @ ${{ github.event.pull_request.head.sha }}\"\n\non:\n pull_request:\n types: [opened, synchronize, reopened, ready_for_review, labeled]\n\njobs:\n review:\n if: >-\n !github.event.pull_request.draft &&\n github.event.pull_request.head.repo.full_name == github.repository &&\n contains(github.event.pull_request.labels.*.name, 'lore:codex-review')\n runs-on: ubuntu-latest\n permissions:\n contents: read\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore-releases' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.29' }}\n outputs:\n final-message: ${{ steps.codex.outputs.final-message }}\n steps:\n - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0\n with:\n fetch-depth: 0\n persist-credentials: false\n path: review\n\n - name: Install Lore CLI\n run: |\n export LORE_REPO=\"$LORE_CLI_REPOSITORY\"\n export LORE_VERSION=\"$LORE_CLI_VERSION\"\n export LORE_BIN_DIR=\"$RUNNER_TEMP/lore/bin\"\n curl -fsSL \"https://github.com/$LORE_CLI_REPOSITORY/releases/download/$LORE_CLI_VERSION/install.sh\" | bash\n\n - name: Prepare Lore review context\n env:\n LORE_API_URL: ${{ vars.LORE_API_URL }}\n LORE_WORKSPACE_TOKEN: ${{ secrets.LORE_WORKSPACE_TOKEN }}\n run: >-\n lore github prepare-review\n --provider codex\n --event \"$GITHUB_EVENT_PATH\"\n --checkout \"$GITHUB_WORKSPACE/review\"\n --prompt-out \"$GITHUB_WORKSPACE/.lore/codex-prompt.md\"\n --metadata-out \"$GITHUB_WORKSPACE/.lore/codex-metadata.json\"\n --schema-out \"$GITHUB_WORKSPACE/.lore/review-output.schema.json\"\n\n - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2\n with:\n name: lore-codex-metadata\n path: .lore/codex-metadata.json\n retention-days: 1\n\n - name: Run Codex\n id: codex\n uses: openai/codex-action@52fe01ec70a42f454c9d2ebd47598f9fd6893d56 # v1.11\n with:\n openai-api-key: ${{ secrets.OPENAI_API_KEY }}\n prompt-file: .lore/codex-prompt.md\n output-schema-file: .lore/review-output.schema.json\n working-directory: review\n permission-profile: \":read-only\"\n safety-strategy: drop-sudo\n\n post:\n needs: review\n if: needs.review.outputs.final-message != ''\n runs-on: ubuntu-latest\n permissions:\n contents: read\n pull-requests: write\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore-releases' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.29' }}\n steps:\n - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0\n with:\n persist-credentials: false\n path: review\n\n - name: Install Lore CLI\n run: |\n export LORE_REPO=\"$LORE_CLI_REPOSITORY\"\n export LORE_VERSION=\"$LORE_CLI_VERSION\"\n export LORE_BIN_DIR=\"$RUNNER_TEMP/lore/bin\"\n curl -fsSL \"https://github.com/$LORE_CLI_REPOSITORY/releases/download/$LORE_CLI_VERSION/install.sh\" | bash\n\n - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0\n with:\n name: lore-codex-metadata\n path: .lore\n\n - name: Save review output\n env:\n CODEX_REVIEW: ${{ needs.review.outputs.final-message }}\n run: |\n mkdir -p .lore\n printf '%s' \"$CODEX_REVIEW\" > .lore/codex-output.json\n\n - name: Post or update Lore review\n env:\n GH_TOKEN: ${{ github.token }}\n run: >-\n lore github post-review\n --metadata .lore/codex-metadata.json\n --output .lore/codex-output.json\n";
|
|
3
|
+
readonly "lore-devin-review.yml": "name: Lore Devin review\nrun-name: \"Lore Devin review [${{ github.event.action }}] PR #${{ github.event.pull_request.number }} @ ${{ github.event.pull_request.head.sha }}\"\n\non:\n pull_request:\n types: [opened, synchronize, reopened, ready_for_review, labeled]\n\nconcurrency:\n group: lore-devin-review-${{ github.repository }}-${{ github.event.pull_request.number }}\n cancel-in-progress: true\n\njobs:\n review:\n if: >-\n !github.event.pull_request.draft &&\n github.event.pull_request.head.repo.full_name == github.repository &&\n contains(github.event.pull_request.labels.*.name, 'lore:devin-review')\n runs-on: ubuntu-latest\n permissions:\n contents: read\n pull-requests: write\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore-releases' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.29' }}\n steps:\n - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0\n with:\n fetch-depth: 0\n persist-credentials: false\n path: review\n\n - name: Install Lore CLI\n run: |\n export LORE_REPO=\"$LORE_CLI_REPOSITORY\"\n export LORE_VERSION=\"$LORE_CLI_VERSION\"\n export LORE_BIN_DIR=\"$RUNNER_TEMP/lore/bin\"\n curl -fsSL \"https://github.com/$LORE_CLI_REPOSITORY/releases/download/$LORE_CLI_VERSION/install.sh\" | bash\n\n - name: Prepare Lore review context\n env:\n LORE_API_URL: ${{ vars.LORE_API_URL }}\n LORE_WORKSPACE_TOKEN: ${{ secrets.LORE_WORKSPACE_TOKEN }}\n run: >-\n lore github prepare-review\n --provider devin\n --event \"$GITHUB_EVENT_PATH\"\n --checkout \"$GITHUB_WORKSPACE/review\"\n --prompt-out \"$GITHUB_WORKSPACE/.lore/devin-prompt.md\"\n --metadata-out \"$GITHUB_WORKSPACE/.lore/devin-metadata.json\"\n\n - name: Run Lore-enriched Devin review\n env:\n DEVIN_API_KEY: ${{ secrets.DEVIN_API_KEY }}\n DEVIN_ORG_ID: ${{ vars.DEVIN_ORG_ID }}\n run: >-\n lore devin run-review\n --prompt .lore/devin-prompt.md\n --metadata .lore/devin-metadata.json\n --output .lore/devin-output.json\n\n - name: Post or update Lore review\n env:\n GH_TOKEN: ${{ github.token }}\n run: >-\n lore github post-review\n --metadata .lore/devin-metadata.json\n --output .lore/devin-output.json\n\n - name: Clean up Devin session\n if: always()\n continue-on-error: true\n env:\n DEVIN_API_KEY: ${{ secrets.DEVIN_API_KEY }}\n DEVIN_ORG_ID: ${{ vars.DEVIN_ORG_ID }}\n run: |\n SESSION_ID=\"$(jq -r '.sessionId // empty' .lore/devin-metadata.json 2>/dev/null || true)\"\n if [ -n \"$SESSION_ID\" ]; then\n lore devin terminate --session \"$SESSION_ID\"\n fi\n";
|
|
4
|
+
readonly "lore-observe-correction.yml": "name: Lore review correction\nrun-name: \"Lore review correction comment #${{ github.event.comment.id }}\"\n\non:\n issue_comment:\n types: [created]\n\njobs:\n observe:\n if: >-\n github.event.issue.pull_request &&\n startsWith(github.event.comment.body, '/lore correct ')\n runs-on: ubuntu-latest\n permissions:\n contents: read\n issues: read\n pull-requests: read\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore-releases' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.29' }}\n steps:\n - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0\n with:\n persist-credentials: false\n path: review\n\n - name: Install Lore CLI\n run: |\n export LORE_REPO=\"$LORE_CLI_REPOSITORY\"\n export LORE_VERSION=\"$LORE_CLI_VERSION\"\n export LORE_BIN_DIR=\"$RUNNER_TEMP/lore/bin\"\n curl -fsSL \"https://github.com/$LORE_CLI_REPOSITORY/releases/download/$LORE_CLI_VERSION/install.sh\" | bash\n\n - name: Teach Lore from an authorized correction\n env:\n GH_TOKEN: ${{ github.token }}\n LORE_API_URL: ${{ vars.LORE_API_URL }}\n LORE_WORKSPACE_TOKEN: ${{ secrets.LORE_WORKSPACE_TOKEN }}\n run: >-\n lore github observe-correction\n --event \"$GITHUB_EVENT_PATH\"\n";
|
|
5
5
|
readonly "review-output.schema.json": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\"summary\", \"findings\"],\n \"properties\": {\n \"summary\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"pattern\": \"\\\\S\"\n },\n \"findings\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\"severity\", \"title\", \"body\", \"path\", \"line\"],\n \"properties\": {\n \"severity\": {\n \"enum\": [\"critical\", \"high\", \"medium\", \"low\"]\n },\n \"title\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"pattern\": \"\\\\S\"\n },\n \"body\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"pattern\": \"\\\\S\"\n },\n \"path\": {\n \"type\": [\"string\", \"null\"],\n \"minLength\": 1,\n \"pattern\": \"\\\\S\"\n },\n \"line\": {\n \"type\": [\"integer\", \"null\"],\n \"minimum\": 1\n }\n }\n }\n }\n }\n}\n";
|
|
6
6
|
};
|
|
7
|
-
export declare const SELF_HOST_COMPOSE_ASSET = "name: lore\n\nx-api-image: &api-image \"${LORE_API_IMAGE:-ghcr.io/treadiehq/lore-api}:${LORE_IMAGE_TAG:-0.1.
|
|
7
|
+
export declare const SELF_HOST_COMPOSE_ASSET = "name: lore\n\nx-api-image: &api-image \"${LORE_API_IMAGE:-ghcr.io/treadiehq/lore-api}:${LORE_IMAGE_TAG:-0.1.29}\"\nx-web-image: &web-image \"${LORE_WEB_IMAGE:-ghcr.io/treadiehq/lore-web}:${LORE_IMAGE_TAG:-0.1.29}\"\n\nservices:\n postgres:\n image: pgvector/pgvector:0.8.6-pg18\n environment:\n POSTGRES_DB: lore\n POSTGRES_USER: lore\n POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-}\n volumes:\n - postgres-data:/var/lib/postgresql\n healthcheck:\n test:\n [\n \"CMD-SHELL\",\n 'pg_isready -h 127.0.0.1 -U \"$${POSTGRES_USER}\" -d \"$${POSTGRES_DB}\"',\n ]\n interval: 5s\n timeout: 5s\n retries: 10\n start_period: 10s\n restart: unless-stopped\n\n api:\n image: *api-image\n environment:\n NODE_ENV: production\n DATABASE_URL: \"postgresql://lore:${POSTGRES_PASSWORD:-}@postgres:5432/lore\"\n API_HOST: 0.0.0.0\n API_PORT: 3001\n API_JSON_BODY_LIMIT: ${API_JSON_BODY_LIMIT:-1mb}\n API_RATE_LIMIT_PER_MINUTE: ${API_RATE_LIMIT_PER_MINUTE:-120}\n RATE_LIMIT_KEY_SECRET: ${RATE_LIMIT_KEY_SECRET:-}\n TRUSTED_PROXY_CIDRS: ${TRUSTED_PROXY_CIDRS:-10.0.0.0/8,172.16.0.0/12}\n NUXT_ORIGIN: ${NUXT_ORIGIN:-}\n LORE_SERVER_VERSION: ${LORE_IMAGE_TAG:-0.1.29}\n LORE_SERVER_REVISION: ${LORE_SERVER_REVISION:-}\n LORE_WORKSPACE_TOKEN: ${LORE_WORKSPACE_TOKEN:-}\n LORE_WORKSPACE_ORGANIZATION: ${LORE_WORKSPACE_ORGANIZATION:-}\n LORE_WORKSPACE_NAME: ${LORE_WORKSPACE_NAME:-}\n AUTH_MODE: ${AUTH_MODE:-magic_link}\n AUTH_EMAIL_MODE: ${AUTH_EMAIL_MODE:-resend}\n AUTH_WEB_ORIGIN: ${AUTH_WEB_ORIGIN:-}\n AUTH_OWNER_EMAIL: ${AUTH_OWNER_EMAIL:-}\n AUTH_EMAIL_FROM: ${AUTH_EMAIL_FROM:-}\n RESEND_API_KEY: ${RESEND_API_KEY:-}\n AUTH_MAGIC_LINK_TTL_MINUTES: ${AUTH_MAGIC_LINK_TTL_MINUTES:-15}\n AUTH_SESSION_TTL_DAYS: ${AUTH_SESSION_TTL_DAYS:-30}\n CLOUD_RECOVERY_ENCRYPTION_KEY: ${CLOUD_RECOVERY_ENCRYPTION_KEY:-}\n CLOUD_RECOVERY_PUBLIC_API_URL: ${CLOUD_RECOVERY_PUBLIC_API_URL:-}\n DEVIN_POLLING_ENABLED: ${DEVIN_POLLING_ENABLED:-false}\n DEVIN_API_KEY: ${DEVIN_API_KEY:-}\n DEVIN_ORG_ID: ${DEVIN_ORG_ID:-}\n DEVIN_REPOSITORY_ALLOWLIST: ${DEVIN_REPOSITORY_ALLOWLIST:-}\n DEVIN_POLL_INTERVAL_MS: ${DEVIN_POLL_INTERVAL_MS:-15000}\n DEVIN_REQUEST_TIMEOUT_MS: ${DEVIN_REQUEST_TIMEOUT_MS:-10000}\n DEVIN_POLL_BATCH_SIZE: ${DEVIN_POLL_BATCH_SIZE:-25}\n EXTRACTOR_PROVIDER: ${EXTRACTOR_PROVIDER:-heuristic}\n EXTRACTOR_MIN_CONFIDENCE: ${EXTRACTOR_MIN_CONFIDENCE:-0.8}\n EXTRACTOR_MODEL: ${EXTRACTOR_MODEL:-}\n EXTRACTOR_BASE_URL: ${EXTRACTOR_BASE_URL:-}\n EXTRACTOR_API_KEY: ${EXTRACTOR_API_KEY:-}\n RETRIEVAL_MODE: ${RETRIEVAL_MODE:-auto}\n EMBEDDING_MODEL: ${EMBEDDING_MODEL:-text-embedding-3-small}\n EMBEDDING_BASE_URL: ${EMBEDDING_BASE_URL:-https://api.openai.com/v1}\n EMBEDDING_API_KEY: ${EMBEDDING_API_KEY:-}\n EMBEDDING_DIMENSIONS: ${EMBEDDING_DIMENSIONS:-1536}\n EMBEDDING_TIMEOUT_MS: ${EMBEDDING_TIMEOUT_MS:-5000}\n EMBEDDING_SPACE_ID: ${EMBEDDING_SPACE_ID:-}\n EMBEDDING_RECONCILE_INTERVAL_MS: ${EMBEDDING_RECONCILE_INTERVAL_MS:-60000}\n EMBEDDING_RECONCILE_BATCH_SIZE: ${EMBEDDING_RECONCILE_BATCH_SIZE:-500}\n EMBEDDING_RECONCILE_PAGE_SIZE: ${EMBEDDING_RECONCILE_PAGE_SIZE:-100}\n CAPTURE_WORKER_POLL_INTERVAL_MS: ${CAPTURE_WORKER_POLL_INTERVAL_MS:-500}\n CAPTURE_WORKER_CONCURRENCY: ${CAPTURE_WORKER_CONCURRENCY:-2}\n CAPTURE_WORKER_LEASE_MS: ${CAPTURE_WORKER_LEASE_MS:-60000}\n CAPTURE_INLINE_TIMEOUT_MS: ${CAPTURE_INLINE_TIMEOUT_MS:-45000}\n SEMANTIC_MIN_SIMILARITY: ${SEMANTIC_MIN_SIMILARITY:-0.4}\n CONTEXT_MAX_ITEMS: ${CONTEXT_MAX_ITEMS:-10}\n CONTEXT_MAX_CHARACTERS: ${CONTEXT_MAX_CHARACTERS:-12000}\n CONTEXT_MAX_ESTIMATED_TOKENS: ${CONTEXT_MAX_ESTIMATED_TOKENS:-4000}\n ports:\n - \"${API_BIND_ADDRESS:-127.0.0.1}:${API_PORT:-3001}:3001\"\n depends_on:\n postgres:\n condition: service_healthy\n healthcheck:\n test:\n [\n \"CMD\",\n \"node\",\n \"-e\",\n \"fetch('http://127.0.0.1:3001/health/ready').then(r=>{if(!r.ok)process.exit(1)}).catch(()=>process.exit(1))\",\n ]\n interval: 5s\n timeout: 5s\n retries: 12\n start_period: 10s\n restart: unless-stopped\n\n web:\n image: *web-image\n environment:\n HOST: 0.0.0.0\n PORT: 3000\n NITRO_HOST: 0.0.0.0\n NITRO_PORT: 3000\n NUXT_LORE_API_URL: http://api:3001\n NUXT_AUTH_COOKIE_NAME: ${NUXT_AUTH_COOKIE_NAME:-lore_session}\n NUXT_AUTH_COOKIE_SECURE: ${NUXT_AUTH_COOKIE_SECURE:-true}\n TRUSTED_PROXY_CIDRS: ${TRUSTED_PROXY_CIDRS:-10.0.0.0/8,172.16.0.0/12}\n NUXT_PUBLIC_API_BASE_URL: /api/lore\n NUXT_PUBLIC_LORE_CONNECTOR_API_URL: ${NUXT_PUBLIC_LORE_CONNECTOR_API_URL:-http://localhost:3001}\n NUXT_PUBLIC_LORE_INSTALL_URL: ${NUXT_PUBLIC_LORE_INSTALL_URL:-https://uselore.co/install.sh}\n ports:\n - \"${NUXT_BIND_ADDRESS:-127.0.0.1}:${NUXT_PORT:-3000}:3000\"\n depends_on:\n api:\n condition: service_healthy\n healthcheck:\n test:\n [\n \"CMD\",\n \"node\",\n \"-e\",\n \"fetch('http://127.0.0.1:3000/health').then(r=>{if(!r.ok)process.exit(1)}).catch(()=>process.exit(1))\",\n ]\n interval: 10s\n timeout: 5s\n retries: 12\n start_period: 15s\n restart: unless-stopped\n\nvolumes:\n postgres-data:\n";
|
|
8
|
+
export declare const VSCODE_RECOVERY_ASSETS: {
|
|
9
|
+
readonly "package.json": "{\n \"name\": \"lore-recovery\",\n \"displayName\": \"Lore Recovery\",\n \"publisher\": \"lore-co\",\n \"version\": \"0.1.0\",\n \"description\": \"Continue a stopped Copilot job in another connected coding tool.\",\n \"engines\": { \"vscode\": \"^1.105.0\" },\n \"main\": \"./extension.cjs\",\n \"activationEvents\": [\"onStartupFinished\"],\n \"extensionKind\": [\"workspace\"],\n \"capabilities\": { \"untrustedWorkspaces\": { \"supported\": false }, \"virtualWorkspaces\": false },\n \"contributes\": { \"commands\": [{ \"command\": \"lore.recovery.status\", \"title\": \"Lore: Show Recovery Status\" }] }\n}\n";
|
|
10
|
+
readonly "extension.cjs": "const vscode = require('vscode');\nconst fs = require('node:fs/promises');\nconst { constants } = require('node:fs');\nconst path = require('node:path');\nconst { tmpdir } = require('node:os');\nconst { spawn } = require('node:child_process');\nconst { fileURLToPath } = require('node:url');\nconst { parseSession, checkpoint, bindActiveSession } = require('./session.cjs');\n\nasync function readActiveSession(saved) {\n if (!saved.length) return;\n const directory = await fs.mkdtemp(path.join(tmpdir(), 'lore-chat-'));\n try {\n await fs.chmod(directory, 0o700);\n const target = path.join(directory, 'active.json');\n await fs.writeFile(target, '', { mode: 0o600 });\n // This public command exports the in-memory chat without opening a dialog.\n await vscode.commands.executeCommand('workbench.action.chat.export', vscode.Uri.file(target));\n const file = await fs.open(target, constants.O_RDONLY | constants.O_NOFOLLOW);\n try {\n const stat = await file.stat();\n if (!stat.isFile() || stat.size > 8 * 1024 * 1024 || (process.getuid && stat.uid !== process.getuid())) return;\n return bindActiveSession(parseSession(await file.readFile('utf8')), saved);\n } finally { await file.close(); }\n } catch { /* Unsupported export commands keep the saved-session fallback. */ }\n finally { await fs.rm(directory, { recursive: true, force: true }); }\n}\n\nfunction activate(context) {\n const output = vscode.window.createOutputChannel('Lore Recovery'); context.subscriptions.push(output);\n let config = require('./connection.json'); // Written by lore connect, outside the repository.\n let busy = false, disposed = false, lastError = '', status = 'Waiting for a saved Copilot turn.';\n const offered = new Set();\n function call(args, input) {\n return new Promise((resolve, reject) => {\n const child = spawn(config.invocation[0], [...config.invocation.slice(1), 'recovery', ...args], {\n env: { ...process.env, PATH: config.path || process.env.PATH, LORE_HOME: config.home, BUN_OPTIONS: undefined, BUN_BE_BUN: undefined }, stdio: ['pipe','pipe','pipe'],\n });\n let body = '', error = ''; const timer = setTimeout(() => { child.kill(); reject(Error('Lore adapter timed out')); }, 10000);\n child.stdout.on('data', b => { body += b; if (body.length > 65536) child.kill(); });\n child.stderr.on('data', b => { error = (error + b).slice(-2000); });\n child.once('error', e => { clearTimeout(timer); reject(e); });\n child.once('exit', code => { clearTimeout(timer); if(code) reject(Error(error || 'Lore adapter failed')); else { try { resolve(JSON.parse(body)); } catch { reject(Error('Invalid Lore response')); } } });\n child.stdin.on('error', () => {}); child.stdin.end(JSON.stringify(input));\n });\n }\n async function poll() {\n if (busy || disposed || !vscode.workspace.isTrusted || !context.storageUri || context.storageUri.scheme !== 'file') return;\n busy = true;\n try {\n config = JSON.parse(await fs.readFile(path.join(__dirname, 'connection.json'), 'utf8'));\n if (config.disabled) { status = 'Lore recovery is disabled.'; return; }\n const folders = (vscode.workspace.workspaceFolders ?? []).filter(f => f.uri.scheme === 'file');\n const roots = await Promise.all(folders.map(f => fs.realpath(f.uri.fsPath)));\n const storage = path.dirname(context.storageUri.fsPath), chatDir = path.join(storage, 'chatSessions');\n // The extension context binds this storage directory to this VS Code workspace.\n const names = (await fs.readdir(chatDir).catch(e => { if(e.code === 'ENOENT') return []; throw e; })).filter(n => /^[a-zA-Z0-9-]+\\.jsonl?$/.test(n) && n !== 'index.json').slice(-400);\n const saved = [];\n for (const name of names) {\n const file = await fs.open(path.join(chatDir,name), constants.O_RDONLY | constants.O_NOFOLLOW);\n let session;\n try {\n const stat = await file.stat();\n if (!stat.isFile() || stat.size > 8*1024*1024 || (process.getuid && stat.uid !== process.getuid())) continue;\n session = parseSession(await file.readFile('utf8'), name.endsWith('.jsonl'));\n } catch (e) { if(e instanceof SyntaxError) continue; throw e; }\n finally { await file.close(); }\n let cwd;\n if (session?.workingDirectory) {\n try { cwd = await fs.realpath(fileURLToPath(session.workingDirectory)); } catch { continue; }\n if (!roots.some(r => cwd === r || cwd.startsWith(r + path.sep))) continue;\n // Recovery configuration registers exact workspaces. Do not guess another root.\n if (!config.roots.includes(cwd)) continue;\n } else if (roots.length === 1) cwd = roots[0]; else continue;\n if (!config.roots.includes(cwd)) continue;\n saved.push({ session, cwd });\n }\n const active = await readActiveSession(saved);\n // Replace the saved copy before processing it, so a live retry/cancellation\n // suppresses an obsolete failure even when disk storage is still behind.\n for (const entry of saved) {\n const { session, cwd } = active?.session.sessionId === entry.session?.sessionId ? active : entry;\n const event = checkpoint(session, cwd); if (!event) continue;\n const timestamp = session.requests?.at(-1)?.timestamp;\n if ((typeof timestamp === 'number' ? timestamp : Date.parse(timestamp)) < config.since || !timestamp) continue;\n const result = await call(['external-checkpoint'], event);\n status = active ? 'Observing active Copilot chat and saved sessions.' : 'Observing saved Copilot sessions; active chat identity is not yet available.';\n if (!result.failureId || offered.has(result.failureId)) continue;\n offered.add(result.failureId);\n const button = `Continue with ${result.target}`;\n void vscode.window.showWarningMessage(`Copilot stopped${event.reason === 'rate_limit' ? ' at a usage limit' : ' with an error'}. Lore can continue this job.`, button, 'Dismiss').then(choice => {\n if(choice !== button || disposed) return;\n const quote = s => `'${s.replaceAll(\"'\", \"'\\\\''\")}'`;\n const command = ['env','-u','BUN_OPTIONS','-u','BUN_BE_BUN',`PATH=${config.path || process.env.PATH}`,`LORE_HOME=${config.home}`, ...config.invocation, 'recovery', 'launch-accepted', result.id, result.failureId].map(quote).join(' ');\n const terminal = vscode.window.createTerminal({ name: 'Lore continuation', cwd }); terminal.show(); terminal.sendText(command, true);\n });\n }\n lastError = '';\n } catch(e) { status = e.message; if(lastError !== status) output.appendLine(status); lastError = status; }\n finally { busy = false; }\n }\n const timer = setInterval(() => { void poll(); }, 1500); void poll();\n context.subscriptions.push({ dispose() { disposed = true; clearInterval(timer); } });\n context.subscriptions.push(vscode.commands.registerCommand('lore.recovery.status', () => vscode.window.showInformationMessage(status)));\n}\nmodule.exports = { activate, readActiveSession };\n";
|
|
11
|
+
readonly "session.cjs": "// VS Code's version 3 chat model and numeric objectMutationLog format.\n// No terminal/answer text matching, proposed API, or Copilot monkey patching.\nconst forbidden = new Set(['__proto__', 'constructor', 'prototype']);\nfunction parseSession(text, jsonl = false) {\n if (Buffer.byteLength(text) > 8 * 1024 * 1024) throw Error('Chat exceeds the 8 MiB recovery read limit');\n if (!jsonl) return JSON.parse(text);\n let state;\n for (const line of text.trimEnd().split('\\n')) {\n if (!line) continue;\n const entry = JSON.parse(line);\n if (entry.kind === 0) { if (state !== undefined) throw Error('Repeated chat initial state'); state = entry.v; continue; }\n if (!state || !Array.isArray(entry.k) || !entry.k.length || entry.k.length > 30 || entry.k.some(k => !(typeof k === 'string' || Number.isSafeInteger(k)) || forbidden.has(k))) throw Error('Unsupported chat mutation');\n let parent = state;\n for (const k of entry.k.slice(0, -1)) {\n if (!parent || !Object.hasOwn(parent, k)) throw Error('Invalid chat mutation path');\n parent = parent[k];\n }\n const key = entry.k.at(-1);\n if (!parent || typeof parent !== 'object') throw Error('Invalid chat mutation target');\n if (entry.kind === 1) parent[key] = entry.v;\n else if (entry.kind === 3) delete parent[key];\n else if (entry.kind === 2) {\n const array = parent[key];\n if (!Array.isArray(array) || (entry.i !== undefined && (!Number.isSafeInteger(entry.i) || entry.i < 0 || entry.i > array.length)) || (entry.v !== undefined && !Array.isArray(entry.v))) throw Error('Invalid chat array mutation');\n if (entry.i !== undefined) array.splice(entry.i);\n if (entry.v) array.push(...entry.v);\n } else throw Error('Unknown chat mutation');\n }\n return state;\n}\nfunction checkpoint(session, cwd) {\n if (session?.version !== 3 || typeof session.sessionId !== 'string' || !Array.isArray(session.requests)) return;\n const requests = session.requests.filter(r => !r.isSystemInitiated && !r.hiddenFromTranscript);\n const last = requests.at(-1);\n if (!last || typeof last.requestId !== 'string' || typeof last.message?.text !== 'string') return;\n const extension = last.agent?.extensionId;\n if ((typeof extension === 'string' ? extension : extension?.value)?.toLowerCase() !== 'github.copilot-chat') return;\n const error = last.result?.errorDetails ?? last.responseErrorDetails;\n const canceled = last.isCanceled === true || error?.code === 'canceled' || last.modelState?.value === 2;\n const failed = !canceled && !!error && typeof error.message === 'string' && !error.responseIsFiltered && !error.responseIsRedacted;\n const messages = requests.slice(-10).flatMap(r => [\n { role: 'user', text: String(r.message?.text ?? '').slice(0,6000) },\n { role: 'assistant', text: (r.response ?? []).filter(p => typeof p?.value === 'string').map(p => p.value).join('\\n').slice(0,6000) },\n ]).filter(m => m.text);\n return { host: 'copilot-vscode', sourceAgent: 'copilot-cli', sessionId: session.sessionId, turnId: last.requestId, cwd,\n goal: String(requests[0]?.message?.text ?? '').slice(0,6000), messages,\n state: canceled ? 'cancelled' : failed ? 'failed' : last.result ? 'completed' : 'running',\n ...(failed ? { reason: error.isRateLimited === true || error.isQuotaExceeded === true || ['rateLimited','quotaExceeded'].includes(error.code) ? 'rate_limit' : 'agent_error' } : {}), observedAt: Date.now() };\n}\n// Live chat export omits sessionId/cwd. Bind only by the ordered stable request\n// IDs of exactly one saved session; never infer identity from a title or text.\nfunction bindActiveSession(exported, saved) {\n if (!Array.isArray(exported?.requests) || !exported.requests.length) return;\n const ids = exported.requests.map(r => r.requestId);\n if (ids.some(id => typeof id !== 'string' || !id) || new Set(ids).size !== ids.length) return;\n const matches = saved.filter(({ session }) => session?.version === 3 && typeof session.sessionId === 'string' &&\n Array.isArray(session.requests) && session.requests.length > 0 && session.requests.length <= ids.length &&\n session.requests.every((r, i) => r.requestId === ids[i]));\n if (matches.length !== 1) return;\n const match = matches[0];\n return { cwd: match.cwd, session: { ...match.session, requests: exported.requests } };\n}\nmodule.exports = { parseSession, checkpoint, bindActiveSession };\n";
|
|
12
|
+
};
|
|
8
13
|
//# sourceMappingURL=generated-assets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generated-assets.d.ts","sourceRoot":"","sources":["../src/generated-assets.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,sBAAsB;;;;;CAKzB,CAAC;AACX,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"generated-assets.d.ts","sourceRoot":"","sources":["../src/generated-assets.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,sBAAsB;;;;;CAKzB,CAAC;AACX,eAAO,MAAM,uBAAuB,y9KAAy9K,CAAC;AAC9/K,eAAO,MAAM,sBAAsB;;;;CAAohY,CAAC"}
|
package/dist/generated-assets.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// Generated by scripts/generate-cli-assets.mjs. Do not edit directly.
|
|
2
2
|
export const GITHUB_TEMPLATE_ASSETS = {
|
|
3
|
-
"lore-codex-review.yml": "name: Lore Codex review\nrun-name: \"Lore Codex review [${{ github.event.action }}] PR #${{ github.event.pull_request.number }} @ ${{ github.event.pull_request.head.sha }}\"\n\non:\n pull_request:\n types: [opened, synchronize, reopened, ready_for_review, labeled]\n\njobs:\n review:\n if: >-\n !github.event.pull_request.draft &&\n github.event.pull_request.head.repo.full_name == github.repository &&\n contains(github.event.pull_request.labels.*.name, 'lore:codex-review')\n runs-on: ubuntu-latest\n permissions:\n contents: read\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore-releases' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.
|
|
4
|
-
"lore-devin-review.yml": "name: Lore Devin review\nrun-name: \"Lore Devin review [${{ github.event.action }}] PR #${{ github.event.pull_request.number }} @ ${{ github.event.pull_request.head.sha }}\"\n\non:\n pull_request:\n types: [opened, synchronize, reopened, ready_for_review, labeled]\n\nconcurrency:\n group: lore-devin-review-${{ github.repository }}-${{ github.event.pull_request.number }}\n cancel-in-progress: true\n\njobs:\n review:\n if: >-\n !github.event.pull_request.draft &&\n github.event.pull_request.head.repo.full_name == github.repository &&\n contains(github.event.pull_request.labels.*.name, 'lore:devin-review')\n runs-on: ubuntu-latest\n permissions:\n contents: read\n pull-requests: write\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore-releases' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.
|
|
5
|
-
"lore-observe-correction.yml": "name: Lore review correction\nrun-name: \"Lore review correction comment #${{ github.event.comment.id }}\"\n\non:\n issue_comment:\n types: [created]\n\njobs:\n observe:\n if: >-\n github.event.issue.pull_request &&\n startsWith(github.event.comment.body, '/lore correct ')\n runs-on: ubuntu-latest\n permissions:\n contents: read\n issues: read\n pull-requests: read\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore-releases' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.
|
|
3
|
+
"lore-codex-review.yml": "name: Lore Codex review\nrun-name: \"Lore Codex review [${{ github.event.action }}] PR #${{ github.event.pull_request.number }} @ ${{ github.event.pull_request.head.sha }}\"\n\non:\n pull_request:\n types: [opened, synchronize, reopened, ready_for_review, labeled]\n\njobs:\n review:\n if: >-\n !github.event.pull_request.draft &&\n github.event.pull_request.head.repo.full_name == github.repository &&\n contains(github.event.pull_request.labels.*.name, 'lore:codex-review')\n runs-on: ubuntu-latest\n permissions:\n contents: read\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore-releases' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.29' }}\n outputs:\n final-message: ${{ steps.codex.outputs.final-message }}\n steps:\n - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0\n with:\n fetch-depth: 0\n persist-credentials: false\n path: review\n\n - name: Install Lore CLI\n run: |\n export LORE_REPO=\"$LORE_CLI_REPOSITORY\"\n export LORE_VERSION=\"$LORE_CLI_VERSION\"\n export LORE_BIN_DIR=\"$RUNNER_TEMP/lore/bin\"\n curl -fsSL \"https://github.com/$LORE_CLI_REPOSITORY/releases/download/$LORE_CLI_VERSION/install.sh\" | bash\n\n - name: Prepare Lore review context\n env:\n LORE_API_URL: ${{ vars.LORE_API_URL }}\n LORE_WORKSPACE_TOKEN: ${{ secrets.LORE_WORKSPACE_TOKEN }}\n run: >-\n lore github prepare-review\n --provider codex\n --event \"$GITHUB_EVENT_PATH\"\n --checkout \"$GITHUB_WORKSPACE/review\"\n --prompt-out \"$GITHUB_WORKSPACE/.lore/codex-prompt.md\"\n --metadata-out \"$GITHUB_WORKSPACE/.lore/codex-metadata.json\"\n --schema-out \"$GITHUB_WORKSPACE/.lore/review-output.schema.json\"\n\n - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2\n with:\n name: lore-codex-metadata\n path: .lore/codex-metadata.json\n retention-days: 1\n\n - name: Run Codex\n id: codex\n uses: openai/codex-action@52fe01ec70a42f454c9d2ebd47598f9fd6893d56 # v1.11\n with:\n openai-api-key: ${{ secrets.OPENAI_API_KEY }}\n prompt-file: .lore/codex-prompt.md\n output-schema-file: .lore/review-output.schema.json\n working-directory: review\n permission-profile: \":read-only\"\n safety-strategy: drop-sudo\n\n post:\n needs: review\n if: needs.review.outputs.final-message != ''\n runs-on: ubuntu-latest\n permissions:\n contents: read\n pull-requests: write\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore-releases' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.29' }}\n steps:\n - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0\n with:\n persist-credentials: false\n path: review\n\n - name: Install Lore CLI\n run: |\n export LORE_REPO=\"$LORE_CLI_REPOSITORY\"\n export LORE_VERSION=\"$LORE_CLI_VERSION\"\n export LORE_BIN_DIR=\"$RUNNER_TEMP/lore/bin\"\n curl -fsSL \"https://github.com/$LORE_CLI_REPOSITORY/releases/download/$LORE_CLI_VERSION/install.sh\" | bash\n\n - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0\n with:\n name: lore-codex-metadata\n path: .lore\n\n - name: Save review output\n env:\n CODEX_REVIEW: ${{ needs.review.outputs.final-message }}\n run: |\n mkdir -p .lore\n printf '%s' \"$CODEX_REVIEW\" > .lore/codex-output.json\n\n - name: Post or update Lore review\n env:\n GH_TOKEN: ${{ github.token }}\n run: >-\n lore github post-review\n --metadata .lore/codex-metadata.json\n --output .lore/codex-output.json\n",
|
|
4
|
+
"lore-devin-review.yml": "name: Lore Devin review\nrun-name: \"Lore Devin review [${{ github.event.action }}] PR #${{ github.event.pull_request.number }} @ ${{ github.event.pull_request.head.sha }}\"\n\non:\n pull_request:\n types: [opened, synchronize, reopened, ready_for_review, labeled]\n\nconcurrency:\n group: lore-devin-review-${{ github.repository }}-${{ github.event.pull_request.number }}\n cancel-in-progress: true\n\njobs:\n review:\n if: >-\n !github.event.pull_request.draft &&\n github.event.pull_request.head.repo.full_name == github.repository &&\n contains(github.event.pull_request.labels.*.name, 'lore:devin-review')\n runs-on: ubuntu-latest\n permissions:\n contents: read\n pull-requests: write\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore-releases' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.29' }}\n steps:\n - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0\n with:\n fetch-depth: 0\n persist-credentials: false\n path: review\n\n - name: Install Lore CLI\n run: |\n export LORE_REPO=\"$LORE_CLI_REPOSITORY\"\n export LORE_VERSION=\"$LORE_CLI_VERSION\"\n export LORE_BIN_DIR=\"$RUNNER_TEMP/lore/bin\"\n curl -fsSL \"https://github.com/$LORE_CLI_REPOSITORY/releases/download/$LORE_CLI_VERSION/install.sh\" | bash\n\n - name: Prepare Lore review context\n env:\n LORE_API_URL: ${{ vars.LORE_API_URL }}\n LORE_WORKSPACE_TOKEN: ${{ secrets.LORE_WORKSPACE_TOKEN }}\n run: >-\n lore github prepare-review\n --provider devin\n --event \"$GITHUB_EVENT_PATH\"\n --checkout \"$GITHUB_WORKSPACE/review\"\n --prompt-out \"$GITHUB_WORKSPACE/.lore/devin-prompt.md\"\n --metadata-out \"$GITHUB_WORKSPACE/.lore/devin-metadata.json\"\n\n - name: Run Lore-enriched Devin review\n env:\n DEVIN_API_KEY: ${{ secrets.DEVIN_API_KEY }}\n DEVIN_ORG_ID: ${{ vars.DEVIN_ORG_ID }}\n run: >-\n lore devin run-review\n --prompt .lore/devin-prompt.md\n --metadata .lore/devin-metadata.json\n --output .lore/devin-output.json\n\n - name: Post or update Lore review\n env:\n GH_TOKEN: ${{ github.token }}\n run: >-\n lore github post-review\n --metadata .lore/devin-metadata.json\n --output .lore/devin-output.json\n\n - name: Clean up Devin session\n if: always()\n continue-on-error: true\n env:\n DEVIN_API_KEY: ${{ secrets.DEVIN_API_KEY }}\n DEVIN_ORG_ID: ${{ vars.DEVIN_ORG_ID }}\n run: |\n SESSION_ID=\"$(jq -r '.sessionId // empty' .lore/devin-metadata.json 2>/dev/null || true)\"\n if [ -n \"$SESSION_ID\" ]; then\n lore devin terminate --session \"$SESSION_ID\"\n fi\n",
|
|
5
|
+
"lore-observe-correction.yml": "name: Lore review correction\nrun-name: \"Lore review correction comment #${{ github.event.comment.id }}\"\n\non:\n issue_comment:\n types: [created]\n\njobs:\n observe:\n if: >-\n github.event.issue.pull_request &&\n startsWith(github.event.comment.body, '/lore correct ')\n runs-on: ubuntu-latest\n permissions:\n contents: read\n issues: read\n pull-requests: read\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore-releases' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.29' }}\n steps:\n - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0\n with:\n persist-credentials: false\n path: review\n\n - name: Install Lore CLI\n run: |\n export LORE_REPO=\"$LORE_CLI_REPOSITORY\"\n export LORE_VERSION=\"$LORE_CLI_VERSION\"\n export LORE_BIN_DIR=\"$RUNNER_TEMP/lore/bin\"\n curl -fsSL \"https://github.com/$LORE_CLI_REPOSITORY/releases/download/$LORE_CLI_VERSION/install.sh\" | bash\n\n - name: Teach Lore from an authorized correction\n env:\n GH_TOKEN: ${{ github.token }}\n LORE_API_URL: ${{ vars.LORE_API_URL }}\n LORE_WORKSPACE_TOKEN: ${{ secrets.LORE_WORKSPACE_TOKEN }}\n run: >-\n lore github observe-correction\n --event \"$GITHUB_EVENT_PATH\"\n",
|
|
6
6
|
"review-output.schema.json": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\"summary\", \"findings\"],\n \"properties\": {\n \"summary\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"pattern\": \"\\\\S\"\n },\n \"findings\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\"severity\", \"title\", \"body\", \"path\", \"line\"],\n \"properties\": {\n \"severity\": {\n \"enum\": [\"critical\", \"high\", \"medium\", \"low\"]\n },\n \"title\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"pattern\": \"\\\\S\"\n },\n \"body\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"pattern\": \"\\\\S\"\n },\n \"path\": {\n \"type\": [\"string\", \"null\"],\n \"minLength\": 1,\n \"pattern\": \"\\\\S\"\n },\n \"line\": {\n \"type\": [\"integer\", \"null\"],\n \"minimum\": 1\n }\n }\n }\n }\n }\n}\n"
|
|
7
7
|
};
|
|
8
|
-
export const SELF_HOST_COMPOSE_ASSET = "name: lore\n\nx-api-image: &api-image \"${LORE_API_IMAGE:-ghcr.io/treadiehq/lore-api}:${LORE_IMAGE_TAG:-0.1.
|
|
8
|
+
export const SELF_HOST_COMPOSE_ASSET = "name: lore\n\nx-api-image: &api-image \"${LORE_API_IMAGE:-ghcr.io/treadiehq/lore-api}:${LORE_IMAGE_TAG:-0.1.29}\"\nx-web-image: &web-image \"${LORE_WEB_IMAGE:-ghcr.io/treadiehq/lore-web}:${LORE_IMAGE_TAG:-0.1.29}\"\n\nservices:\n postgres:\n image: pgvector/pgvector:0.8.6-pg18\n environment:\n POSTGRES_DB: lore\n POSTGRES_USER: lore\n POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-}\n volumes:\n - postgres-data:/var/lib/postgresql\n healthcheck:\n test:\n [\n \"CMD-SHELL\",\n 'pg_isready -h 127.0.0.1 -U \"$${POSTGRES_USER}\" -d \"$${POSTGRES_DB}\"',\n ]\n interval: 5s\n timeout: 5s\n retries: 10\n start_period: 10s\n restart: unless-stopped\n\n api:\n image: *api-image\n environment:\n NODE_ENV: production\n DATABASE_URL: \"postgresql://lore:${POSTGRES_PASSWORD:-}@postgres:5432/lore\"\n API_HOST: 0.0.0.0\n API_PORT: 3001\n API_JSON_BODY_LIMIT: ${API_JSON_BODY_LIMIT:-1mb}\n API_RATE_LIMIT_PER_MINUTE: ${API_RATE_LIMIT_PER_MINUTE:-120}\n RATE_LIMIT_KEY_SECRET: ${RATE_LIMIT_KEY_SECRET:-}\n TRUSTED_PROXY_CIDRS: ${TRUSTED_PROXY_CIDRS:-10.0.0.0/8,172.16.0.0/12}\n NUXT_ORIGIN: ${NUXT_ORIGIN:-}\n LORE_SERVER_VERSION: ${LORE_IMAGE_TAG:-0.1.29}\n LORE_SERVER_REVISION: ${LORE_SERVER_REVISION:-}\n LORE_WORKSPACE_TOKEN: ${LORE_WORKSPACE_TOKEN:-}\n LORE_WORKSPACE_ORGANIZATION: ${LORE_WORKSPACE_ORGANIZATION:-}\n LORE_WORKSPACE_NAME: ${LORE_WORKSPACE_NAME:-}\n AUTH_MODE: ${AUTH_MODE:-magic_link}\n AUTH_EMAIL_MODE: ${AUTH_EMAIL_MODE:-resend}\n AUTH_WEB_ORIGIN: ${AUTH_WEB_ORIGIN:-}\n AUTH_OWNER_EMAIL: ${AUTH_OWNER_EMAIL:-}\n AUTH_EMAIL_FROM: ${AUTH_EMAIL_FROM:-}\n RESEND_API_KEY: ${RESEND_API_KEY:-}\n AUTH_MAGIC_LINK_TTL_MINUTES: ${AUTH_MAGIC_LINK_TTL_MINUTES:-15}\n AUTH_SESSION_TTL_DAYS: ${AUTH_SESSION_TTL_DAYS:-30}\n CLOUD_RECOVERY_ENCRYPTION_KEY: ${CLOUD_RECOVERY_ENCRYPTION_KEY:-}\n CLOUD_RECOVERY_PUBLIC_API_URL: ${CLOUD_RECOVERY_PUBLIC_API_URL:-}\n DEVIN_POLLING_ENABLED: ${DEVIN_POLLING_ENABLED:-false}\n DEVIN_API_KEY: ${DEVIN_API_KEY:-}\n DEVIN_ORG_ID: ${DEVIN_ORG_ID:-}\n DEVIN_REPOSITORY_ALLOWLIST: ${DEVIN_REPOSITORY_ALLOWLIST:-}\n DEVIN_POLL_INTERVAL_MS: ${DEVIN_POLL_INTERVAL_MS:-15000}\n DEVIN_REQUEST_TIMEOUT_MS: ${DEVIN_REQUEST_TIMEOUT_MS:-10000}\n DEVIN_POLL_BATCH_SIZE: ${DEVIN_POLL_BATCH_SIZE:-25}\n EXTRACTOR_PROVIDER: ${EXTRACTOR_PROVIDER:-heuristic}\n EXTRACTOR_MIN_CONFIDENCE: ${EXTRACTOR_MIN_CONFIDENCE:-0.8}\n EXTRACTOR_MODEL: ${EXTRACTOR_MODEL:-}\n EXTRACTOR_BASE_URL: ${EXTRACTOR_BASE_URL:-}\n EXTRACTOR_API_KEY: ${EXTRACTOR_API_KEY:-}\n RETRIEVAL_MODE: ${RETRIEVAL_MODE:-auto}\n EMBEDDING_MODEL: ${EMBEDDING_MODEL:-text-embedding-3-small}\n EMBEDDING_BASE_URL: ${EMBEDDING_BASE_URL:-https://api.openai.com/v1}\n EMBEDDING_API_KEY: ${EMBEDDING_API_KEY:-}\n EMBEDDING_DIMENSIONS: ${EMBEDDING_DIMENSIONS:-1536}\n EMBEDDING_TIMEOUT_MS: ${EMBEDDING_TIMEOUT_MS:-5000}\n EMBEDDING_SPACE_ID: ${EMBEDDING_SPACE_ID:-}\n EMBEDDING_RECONCILE_INTERVAL_MS: ${EMBEDDING_RECONCILE_INTERVAL_MS:-60000}\n EMBEDDING_RECONCILE_BATCH_SIZE: ${EMBEDDING_RECONCILE_BATCH_SIZE:-500}\n EMBEDDING_RECONCILE_PAGE_SIZE: ${EMBEDDING_RECONCILE_PAGE_SIZE:-100}\n CAPTURE_WORKER_POLL_INTERVAL_MS: ${CAPTURE_WORKER_POLL_INTERVAL_MS:-500}\n CAPTURE_WORKER_CONCURRENCY: ${CAPTURE_WORKER_CONCURRENCY:-2}\n CAPTURE_WORKER_LEASE_MS: ${CAPTURE_WORKER_LEASE_MS:-60000}\n CAPTURE_INLINE_TIMEOUT_MS: ${CAPTURE_INLINE_TIMEOUT_MS:-45000}\n SEMANTIC_MIN_SIMILARITY: ${SEMANTIC_MIN_SIMILARITY:-0.4}\n CONTEXT_MAX_ITEMS: ${CONTEXT_MAX_ITEMS:-10}\n CONTEXT_MAX_CHARACTERS: ${CONTEXT_MAX_CHARACTERS:-12000}\n CONTEXT_MAX_ESTIMATED_TOKENS: ${CONTEXT_MAX_ESTIMATED_TOKENS:-4000}\n ports:\n - \"${API_BIND_ADDRESS:-127.0.0.1}:${API_PORT:-3001}:3001\"\n depends_on:\n postgres:\n condition: service_healthy\n healthcheck:\n test:\n [\n \"CMD\",\n \"node\",\n \"-e\",\n \"fetch('http://127.0.0.1:3001/health/ready').then(r=>{if(!r.ok)process.exit(1)}).catch(()=>process.exit(1))\",\n ]\n interval: 5s\n timeout: 5s\n retries: 12\n start_period: 10s\n restart: unless-stopped\n\n web:\n image: *web-image\n environment:\n HOST: 0.0.0.0\n PORT: 3000\n NITRO_HOST: 0.0.0.0\n NITRO_PORT: 3000\n NUXT_LORE_API_URL: http://api:3001\n NUXT_AUTH_COOKIE_NAME: ${NUXT_AUTH_COOKIE_NAME:-lore_session}\n NUXT_AUTH_COOKIE_SECURE: ${NUXT_AUTH_COOKIE_SECURE:-true}\n TRUSTED_PROXY_CIDRS: ${TRUSTED_PROXY_CIDRS:-10.0.0.0/8,172.16.0.0/12}\n NUXT_PUBLIC_API_BASE_URL: /api/lore\n NUXT_PUBLIC_LORE_CONNECTOR_API_URL: ${NUXT_PUBLIC_LORE_CONNECTOR_API_URL:-http://localhost:3001}\n NUXT_PUBLIC_LORE_INSTALL_URL: ${NUXT_PUBLIC_LORE_INSTALL_URL:-https://uselore.co/install.sh}\n ports:\n - \"${NUXT_BIND_ADDRESS:-127.0.0.1}:${NUXT_PORT:-3000}:3000\"\n depends_on:\n api:\n condition: service_healthy\n healthcheck:\n test:\n [\n \"CMD\",\n \"node\",\n \"-e\",\n \"fetch('http://127.0.0.1:3000/health').then(r=>{if(!r.ok)process.exit(1)}).catch(()=>process.exit(1))\",\n ]\n interval: 10s\n timeout: 5s\n retries: 12\n start_period: 15s\n restart: unless-stopped\n\nvolumes:\n postgres-data:\n";
|
|
9
|
+
export const VSCODE_RECOVERY_ASSETS = { "package.json": "{\n \"name\": \"lore-recovery\",\n \"displayName\": \"Lore Recovery\",\n \"publisher\": \"lore-co\",\n \"version\": \"0.1.0\",\n \"description\": \"Continue a stopped Copilot job in another connected coding tool.\",\n \"engines\": { \"vscode\": \"^1.105.0\" },\n \"main\": \"./extension.cjs\",\n \"activationEvents\": [\"onStartupFinished\"],\n \"extensionKind\": [\"workspace\"],\n \"capabilities\": { \"untrustedWorkspaces\": { \"supported\": false }, \"virtualWorkspaces\": false },\n \"contributes\": { \"commands\": [{ \"command\": \"lore.recovery.status\", \"title\": \"Lore: Show Recovery Status\" }] }\n}\n", "extension.cjs": "const vscode = require('vscode');\nconst fs = require('node:fs/promises');\nconst { constants } = require('node:fs');\nconst path = require('node:path');\nconst { tmpdir } = require('node:os');\nconst { spawn } = require('node:child_process');\nconst { fileURLToPath } = require('node:url');\nconst { parseSession, checkpoint, bindActiveSession } = require('./session.cjs');\n\nasync function readActiveSession(saved) {\n if (!saved.length) return;\n const directory = await fs.mkdtemp(path.join(tmpdir(), 'lore-chat-'));\n try {\n await fs.chmod(directory, 0o700);\n const target = path.join(directory, 'active.json');\n await fs.writeFile(target, '', { mode: 0o600 });\n // This public command exports the in-memory chat without opening a dialog.\n await vscode.commands.executeCommand('workbench.action.chat.export', vscode.Uri.file(target));\n const file = await fs.open(target, constants.O_RDONLY | constants.O_NOFOLLOW);\n try {\n const stat = await file.stat();\n if (!stat.isFile() || stat.size > 8 * 1024 * 1024 || (process.getuid && stat.uid !== process.getuid())) return;\n return bindActiveSession(parseSession(await file.readFile('utf8')), saved);\n } finally { await file.close(); }\n } catch { /* Unsupported export commands keep the saved-session fallback. */ }\n finally { await fs.rm(directory, { recursive: true, force: true }); }\n}\n\nfunction activate(context) {\n const output = vscode.window.createOutputChannel('Lore Recovery'); context.subscriptions.push(output);\n let config = require('./connection.json'); // Written by lore connect, outside the repository.\n let busy = false, disposed = false, lastError = '', status = 'Waiting for a saved Copilot turn.';\n const offered = new Set();\n function call(args, input) {\n return new Promise((resolve, reject) => {\n const child = spawn(config.invocation[0], [...config.invocation.slice(1), 'recovery', ...args], {\n env: { ...process.env, PATH: config.path || process.env.PATH, LORE_HOME: config.home, BUN_OPTIONS: undefined, BUN_BE_BUN: undefined }, stdio: ['pipe','pipe','pipe'],\n });\n let body = '', error = ''; const timer = setTimeout(() => { child.kill(); reject(Error('Lore adapter timed out')); }, 10000);\n child.stdout.on('data', b => { body += b; if (body.length > 65536) child.kill(); });\n child.stderr.on('data', b => { error = (error + b).slice(-2000); });\n child.once('error', e => { clearTimeout(timer); reject(e); });\n child.once('exit', code => { clearTimeout(timer); if(code) reject(Error(error || 'Lore adapter failed')); else { try { resolve(JSON.parse(body)); } catch { reject(Error('Invalid Lore response')); } } });\n child.stdin.on('error', () => {}); child.stdin.end(JSON.stringify(input));\n });\n }\n async function poll() {\n if (busy || disposed || !vscode.workspace.isTrusted || !context.storageUri || context.storageUri.scheme !== 'file') return;\n busy = true;\n try {\n config = JSON.parse(await fs.readFile(path.join(__dirname, 'connection.json'), 'utf8'));\n if (config.disabled) { status = 'Lore recovery is disabled.'; return; }\n const folders = (vscode.workspace.workspaceFolders ?? []).filter(f => f.uri.scheme === 'file');\n const roots = await Promise.all(folders.map(f => fs.realpath(f.uri.fsPath)));\n const storage = path.dirname(context.storageUri.fsPath), chatDir = path.join(storage, 'chatSessions');\n // The extension context binds this storage directory to this VS Code workspace.\n const names = (await fs.readdir(chatDir).catch(e => { if(e.code === 'ENOENT') return []; throw e; })).filter(n => /^[a-zA-Z0-9-]+\\.jsonl?$/.test(n) && n !== 'index.json').slice(-400);\n const saved = [];\n for (const name of names) {\n const file = await fs.open(path.join(chatDir,name), constants.O_RDONLY | constants.O_NOFOLLOW);\n let session;\n try {\n const stat = await file.stat();\n if (!stat.isFile() || stat.size > 8*1024*1024 || (process.getuid && stat.uid !== process.getuid())) continue;\n session = parseSession(await file.readFile('utf8'), name.endsWith('.jsonl'));\n } catch (e) { if(e instanceof SyntaxError) continue; throw e; }\n finally { await file.close(); }\n let cwd;\n if (session?.workingDirectory) {\n try { cwd = await fs.realpath(fileURLToPath(session.workingDirectory)); } catch { continue; }\n if (!roots.some(r => cwd === r || cwd.startsWith(r + path.sep))) continue;\n // Recovery configuration registers exact workspaces. Do not guess another root.\n if (!config.roots.includes(cwd)) continue;\n } else if (roots.length === 1) cwd = roots[0]; else continue;\n if (!config.roots.includes(cwd)) continue;\n saved.push({ session, cwd });\n }\n const active = await readActiveSession(saved);\n // Replace the saved copy before processing it, so a live retry/cancellation\n // suppresses an obsolete failure even when disk storage is still behind.\n for (const entry of saved) {\n const { session, cwd } = active?.session.sessionId === entry.session?.sessionId ? active : entry;\n const event = checkpoint(session, cwd); if (!event) continue;\n const timestamp = session.requests?.at(-1)?.timestamp;\n if ((typeof timestamp === 'number' ? timestamp : Date.parse(timestamp)) < config.since || !timestamp) continue;\n const result = await call(['external-checkpoint'], event);\n status = active ? 'Observing active Copilot chat and saved sessions.' : 'Observing saved Copilot sessions; active chat identity is not yet available.';\n if (!result.failureId || offered.has(result.failureId)) continue;\n offered.add(result.failureId);\n const button = `Continue with ${result.target}`;\n void vscode.window.showWarningMessage(`Copilot stopped${event.reason === 'rate_limit' ? ' at a usage limit' : ' with an error'}. Lore can continue this job.`, button, 'Dismiss').then(choice => {\n if(choice !== button || disposed) return;\n const quote = s => `'${s.replaceAll(\"'\", \"'\\\\''\")}'`;\n const command = ['env','-u','BUN_OPTIONS','-u','BUN_BE_BUN',`PATH=${config.path || process.env.PATH}`,`LORE_HOME=${config.home}`, ...config.invocation, 'recovery', 'launch-accepted', result.id, result.failureId].map(quote).join(' ');\n const terminal = vscode.window.createTerminal({ name: 'Lore continuation', cwd }); terminal.show(); terminal.sendText(command, true);\n });\n }\n lastError = '';\n } catch(e) { status = e.message; if(lastError !== status) output.appendLine(status); lastError = status; }\n finally { busy = false; }\n }\n const timer = setInterval(() => { void poll(); }, 1500); void poll();\n context.subscriptions.push({ dispose() { disposed = true; clearInterval(timer); } });\n context.subscriptions.push(vscode.commands.registerCommand('lore.recovery.status', () => vscode.window.showInformationMessage(status)));\n}\nmodule.exports = { activate, readActiveSession };\n", "session.cjs": "// VS Code's version 3 chat model and numeric objectMutationLog format.\n// No terminal/answer text matching, proposed API, or Copilot monkey patching.\nconst forbidden = new Set(['__proto__', 'constructor', 'prototype']);\nfunction parseSession(text, jsonl = false) {\n if (Buffer.byteLength(text) > 8 * 1024 * 1024) throw Error('Chat exceeds the 8 MiB recovery read limit');\n if (!jsonl) return JSON.parse(text);\n let state;\n for (const line of text.trimEnd().split('\\n')) {\n if (!line) continue;\n const entry = JSON.parse(line);\n if (entry.kind === 0) { if (state !== undefined) throw Error('Repeated chat initial state'); state = entry.v; continue; }\n if (!state || !Array.isArray(entry.k) || !entry.k.length || entry.k.length > 30 || entry.k.some(k => !(typeof k === 'string' || Number.isSafeInteger(k)) || forbidden.has(k))) throw Error('Unsupported chat mutation');\n let parent = state;\n for (const k of entry.k.slice(0, -1)) {\n if (!parent || !Object.hasOwn(parent, k)) throw Error('Invalid chat mutation path');\n parent = parent[k];\n }\n const key = entry.k.at(-1);\n if (!parent || typeof parent !== 'object') throw Error('Invalid chat mutation target');\n if (entry.kind === 1) parent[key] = entry.v;\n else if (entry.kind === 3) delete parent[key];\n else if (entry.kind === 2) {\n const array = parent[key];\n if (!Array.isArray(array) || (entry.i !== undefined && (!Number.isSafeInteger(entry.i) || entry.i < 0 || entry.i > array.length)) || (entry.v !== undefined && !Array.isArray(entry.v))) throw Error('Invalid chat array mutation');\n if (entry.i !== undefined) array.splice(entry.i);\n if (entry.v) array.push(...entry.v);\n } else throw Error('Unknown chat mutation');\n }\n return state;\n}\nfunction checkpoint(session, cwd) {\n if (session?.version !== 3 || typeof session.sessionId !== 'string' || !Array.isArray(session.requests)) return;\n const requests = session.requests.filter(r => !r.isSystemInitiated && !r.hiddenFromTranscript);\n const last = requests.at(-1);\n if (!last || typeof last.requestId !== 'string' || typeof last.message?.text !== 'string') return;\n const extension = last.agent?.extensionId;\n if ((typeof extension === 'string' ? extension : extension?.value)?.toLowerCase() !== 'github.copilot-chat') return;\n const error = last.result?.errorDetails ?? last.responseErrorDetails;\n const canceled = last.isCanceled === true || error?.code === 'canceled' || last.modelState?.value === 2;\n const failed = !canceled && !!error && typeof error.message === 'string' && !error.responseIsFiltered && !error.responseIsRedacted;\n const messages = requests.slice(-10).flatMap(r => [\n { role: 'user', text: String(r.message?.text ?? '').slice(0,6000) },\n { role: 'assistant', text: (r.response ?? []).filter(p => typeof p?.value === 'string').map(p => p.value).join('\\n').slice(0,6000) },\n ]).filter(m => m.text);\n return { host: 'copilot-vscode', sourceAgent: 'copilot-cli', sessionId: session.sessionId, turnId: last.requestId, cwd,\n goal: String(requests[0]?.message?.text ?? '').slice(0,6000), messages,\n state: canceled ? 'cancelled' : failed ? 'failed' : last.result ? 'completed' : 'running',\n ...(failed ? { reason: error.isRateLimited === true || error.isQuotaExceeded === true || ['rateLimited','quotaExceeded'].includes(error.code) ? 'rate_limit' : 'agent_error' } : {}), observedAt: Date.now() };\n}\n// Live chat export omits sessionId/cwd. Bind only by the ordered stable request\n// IDs of exactly one saved session; never infer identity from a title or text.\nfunction bindActiveSession(exported, saved) {\n if (!Array.isArray(exported?.requests) || !exported.requests.length) return;\n const ids = exported.requests.map(r => r.requestId);\n if (ids.some(id => typeof id !== 'string' || !id) || new Set(ids).size !== ids.length) return;\n const matches = saved.filter(({ session }) => session?.version === 3 && typeof session.sessionId === 'string' &&\n Array.isArray(session.requests) && session.requests.length > 0 && session.requests.length <= ids.length &&\n session.requests.every((r, i) => r.requestId === ids[i]));\n if (matches.length !== 1) return;\n const match = matches[0];\n return { cwd: match.cwd, session: { ...match.session, requests: exported.requests } };\n}\nmodule.exports = { parseSession, checkpoint, bindActiveSession };\n" };
|
|
9
10
|
//# sourceMappingURL=generated-assets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generated-assets.js","sourceRoot":"","sources":["../src/generated-assets.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,uBAAuB,EAAE,+8HAA+8H;IACx+H,uBAAuB,EAAE,25FAA25F;IACp7F,6BAA6B,EAAE,q4CAAq4C;IACp6C,2BAA2B,EAAE,+tCAA+tC;CACpvC,CAAC;AACX,MAAM,CAAC,MAAM,uBAAuB,GAAG,
|
|
1
|
+
{"version":3,"file":"generated-assets.js","sourceRoot":"","sources":["../src/generated-assets.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,uBAAuB,EAAE,+8HAA+8H;IACx+H,uBAAuB,EAAE,25FAA25F;IACp7F,6BAA6B,EAAE,q4CAAq4C;IACp6C,2BAA2B,EAAE,+tCAA+tC;CACpvC,CAAC;AACX,MAAM,CAAC,MAAM,uBAAuB,GAAG,s9KAAs9K,CAAC;AAC9/K,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAC,cAAc,EAAC,mnBAAmnB,EAAC,eAAe,EAAC,ygOAAygO,EAAC,aAAa,EAAC,21IAA21I,EAAU,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type CloudOffer, type RecoveryPacket } from "@lore-co/core";
|
|
3
|
+
export declare const SnapshotChunk: z.ZodObject<{
|
|
4
|
+
index: z.ZodNumber;
|
|
5
|
+
total: z.ZodNumber;
|
|
6
|
+
digest: z.ZodString;
|
|
7
|
+
data: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare function readCloudSnapshot(offer: CloudOffer, get: (index: number) => Promise<z.infer<typeof SnapshotChunk>>): Promise<RecoveryPacket>;
|
|
10
|
+
export declare function runCloudWorkspaceCommand(args: readonly string[], home: string): Promise<void>;
|
|
11
|
+
//# sourceMappingURL=recovery-cloud-workspace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recovery-cloud-workspace.d.ts","sourceRoot":"","sources":["../src/recovery-cloud-workspace.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAiE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAOpI,eAAO,MAAM,aAAa;;;;;iBAAwK,CAAC;AAInM,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAclJ;AAED,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoDnG"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { CloudOfferSchema, CloudRepositorySchema, RecoveryPacketSchema } from "@lore-co/core";
|
|
5
|
+
import { createPortableRecoveryPacket, importRecoveryPacket, MAX_TRANSFER_BYTES } from "./recovery-transfer.js";
|
|
6
|
+
import { createRecoveryRun } from "./recovery-state.js";
|
|
7
|
+
import { execFile as callback } from "node:child_process";
|
|
8
|
+
import { promisify } from "node:util";
|
|
9
|
+
const execFile = promisify(callback);
|
|
10
|
+
const ok = z.object({ ok: z.boolean() });
|
|
11
|
+
export const SnapshotChunk = z.object({ index: z.number().int().nonnegative(), total: z.number().int().min(1).max(32), digest: z.string().regex(/^[a-f0-9]{64}$/), data: z.string().max(524288) });
|
|
12
|
+
const digest = (v) => createHash("sha256").update(v).digest("hex");
|
|
13
|
+
const repo = async (cwd) => CloudRepositorySchema.parse((await execFile("git", ["remote", "get-url", "origin"], { cwd, timeout: 5000 })).stdout.trim().replace(/^git@github\.com:/, "https://github.com/").replace(/\.git$/, ""));
|
|
14
|
+
export async function readCloudSnapshot(offer, get) {
|
|
15
|
+
if (!offer.snapshot)
|
|
16
|
+
throw new Error("No workspace snapshot is available");
|
|
17
|
+
let data = "", total = 1;
|
|
18
|
+
for (let index = 0; index < total; index++) {
|
|
19
|
+
const chunk = SnapshotChunk.parse(await get(index));
|
|
20
|
+
if (chunk.index !== index || chunk.digest !== offer.snapshot.digest || (index && chunk.total !== total))
|
|
21
|
+
throw new Error("Snapshot chunks do not match the accepted offer");
|
|
22
|
+
total = chunk.total;
|
|
23
|
+
data += chunk.data;
|
|
24
|
+
if (data.length > Math.ceil(MAX_TRANSFER_BYTES / 3) * 4)
|
|
25
|
+
throw new Error("Snapshot exceeds the transfer limit");
|
|
26
|
+
}
|
|
27
|
+
const raw = Buffer.from(data, "base64").toString("utf8");
|
|
28
|
+
if (Buffer.byteLength(raw) !== offer.snapshot.bytes || digest(raw) !== offer.snapshot.digest)
|
|
29
|
+
throw new Error("Snapshot digest does not match; no files were restored");
|
|
30
|
+
const packet = RecoveryPacketSchema.parse(JSON.parse(raw));
|
|
31
|
+
if (!packet.bundle || !packet.manifest || packet.head !== offer.snapshot.head)
|
|
32
|
+
throw new Error("Snapshot is incomplete");
|
|
33
|
+
return packet;
|
|
34
|
+
}
|
|
35
|
+
export async function runCloudWorkspaceCommand(args, home) {
|
|
36
|
+
const option = (key) => { const i = args.indexOf(key); return i < 0 ? undefined : args[i + 1]; };
|
|
37
|
+
const apiUrl = new URL(option("--api-url") ?? "");
|
|
38
|
+
if (apiUrl.username || apiUrl.password || apiUrl.search || apiUrl.hash || apiUrl.pathname !== "/" || (apiUrl.protocol !== "https:" && !(apiUrl.protocol === "http:" && ["127.0.0.1", "localhost", "[::1]"].includes(apiUrl.hostname))))
|
|
39
|
+
throw new Error("Use the Lore server HTTPS origin (loopback HTTP is allowed for tests)");
|
|
40
|
+
const receive = args[0] === "receive", id = z.uuid().parse(option(receive ? "--offer" : "--job"));
|
|
41
|
+
const token = process.env[receive ? "LORE_CLOUD_RECEIVE_TOKEN" : "LORE_CLOUD_SOURCE_TOKEN"];
|
|
42
|
+
if (!token || !/^[a-f0-9]{64}$/.test(token))
|
|
43
|
+
throw new Error("Set the job-scoped credential in the environment before starting this command");
|
|
44
|
+
const base = `/v1/cloud-recovery/${receive ? "receivers" : "sources"}/${id}`;
|
|
45
|
+
async function request(path, schema, body) {
|
|
46
|
+
const response = await fetch(apiUrl.origin + base + path, { method: "POST", redirect: "error", headers: { authorization: `Bearer ${token}`, "content-type": "application/json" }, body: JSON.stringify(body ?? {}), signal: AbortSignal.timeout(15000) });
|
|
47
|
+
if (!response.ok)
|
|
48
|
+
throw new Error(`Workspace transfer HTTP ${response.status}; check pairing and offer state`);
|
|
49
|
+
const chunks = [];
|
|
50
|
+
let bytes = 0;
|
|
51
|
+
if (response.body)
|
|
52
|
+
for await (const chunk of response.body) {
|
|
53
|
+
bytes += chunk.byteLength;
|
|
54
|
+
if (bytes > 1024 * 1024)
|
|
55
|
+
throw new Error("Workspace response exceeds 1 MiB");
|
|
56
|
+
chunks.push(Buffer.from(chunk));
|
|
57
|
+
}
|
|
58
|
+
return schema.parse(JSON.parse(Buffer.concat(chunks).toString("utf8")));
|
|
59
|
+
}
|
|
60
|
+
if (receive) {
|
|
61
|
+
const offer = await request("/poll", CloudOfferSchema);
|
|
62
|
+
if (await repo(process.cwd()) !== offer.observation.repository)
|
|
63
|
+
throw new Error("Receiving checkout does not match the accepted repository");
|
|
64
|
+
const packet = await readCloudSnapshot(offer, i => request(`/chunks/${i}`, SnapshotChunk));
|
|
65
|
+
const restored = await importRecoveryPacket(process.cwd(), resolve(home, ".lore/recovery/cloud-worktrees", id), packet);
|
|
66
|
+
await request("/restored", ok, { digest: offer.snapshot.digest });
|
|
67
|
+
process.stdout.write(JSON.stringify({ cwd: restored.cwd, digest: restored.digest, brief: restored.brief }) + "\n");
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
let stopped = false, failures = 0;
|
|
71
|
+
const stop = () => { stopped = true; };
|
|
72
|
+
process.once("SIGINT", stop);
|
|
73
|
+
process.once("SIGTERM", stop);
|
|
74
|
+
process.stdout.write("Cloud workspace exporter started. It waits for a verified failure in the paired job.\n");
|
|
75
|
+
try {
|
|
76
|
+
do {
|
|
77
|
+
try {
|
|
78
|
+
const polled = await request("/poll", z.object({ repository: CloudRepositorySchema, sessionId: z.string(), offer: CloudOfferSchema.nullable() }));
|
|
79
|
+
if (await repo(process.cwd()) !== polled.repository)
|
|
80
|
+
throw new Error("Exporter checkout does not match the paired repository");
|
|
81
|
+
if (polled.offer) {
|
|
82
|
+
const offer = polled.offer;
|
|
83
|
+
if (offer.sessionId !== polled.sessionId || offer.observation.state !== "failed" || offer.status !== "offered")
|
|
84
|
+
throw new Error("Export request does not match the paired failure");
|
|
85
|
+
const run = await createRecoveryRun(home, process.cwd(), offer.provider, "codex");
|
|
86
|
+
run.goal = offer.observation.goal;
|
|
87
|
+
run.messages = offer.observation.messages;
|
|
88
|
+
run.sessionId = offer.sessionId;
|
|
89
|
+
const raw = JSON.stringify(await createPortableRecoveryPacket(run)), encoded = Buffer.from(raw).toString("base64"), sha = digest(raw), total = Math.ceil(encoded.length / 524288);
|
|
90
|
+
for (let index = 0; index < total; index++)
|
|
91
|
+
await request(`/offers/${offer.id}/chunks`, ok, { revision: offer.revision, digest: sha, index, total, data: encoded.slice(index * 524288, (index + 1) * 524288) });
|
|
92
|
+
await request(`/offers/${offer.id}/complete`, ok);
|
|
93
|
+
process.stdout.write(`Workspace snapshot exported for offer ${offer.id}.\n`);
|
|
94
|
+
}
|
|
95
|
+
failures = 0;
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
const message = error instanceof Error ? error.message : "Workspace export failed";
|
|
99
|
+
if (args.includes("--once") || /HTTP (?:400|401|403|404)/.test(message) || ++failures >= 3)
|
|
100
|
+
throw error;
|
|
101
|
+
process.stderr.write(`Workspace export could not finish; retrying (${failures}/3). No partial snapshot was accepted.\n`);
|
|
102
|
+
}
|
|
103
|
+
if (args.includes("--once") || stopped)
|
|
104
|
+
break;
|
|
105
|
+
await new Promise(done => setTimeout(done, 5000));
|
|
106
|
+
} while (!stopped);
|
|
107
|
+
}
|
|
108
|
+
finally {
|
|
109
|
+
process.removeListener("SIGINT", stop);
|
|
110
|
+
process.removeListener("SIGTERM", stop);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=recovery-cloud-workspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recovery-cloud-workspace.js","sourceRoot":"","sources":["../src/recovery-cloud-workspace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,oBAAoB,EAAwC,MAAM,eAAe,CAAC;AACpI,OAAO,EAAE,4BAA4B,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAChH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,QAAQ,IAAI,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AACrC,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AACzC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CA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ig, type LorePaths } from "./cli.js";
|
|
4
|
+
declare const Runner: z.ZodObject<{
|
|
5
|
+
id: z.ZodUUID;
|
|
6
|
+
secret: z.ZodString;
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
cwd: z.ZodString;
|
|
9
|
+
repository: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
10
|
+
agents: z.ZodArray<z.ZodEnum<{
|
|
11
|
+
cursor: "cursor";
|
|
12
|
+
devin: "devin";
|
|
13
|
+
claude: "claude";
|
|
14
|
+
codex: "codex";
|
|
15
|
+
opencode: "opencode";
|
|
16
|
+
"copilot-cli": "copilot-cli";
|
|
17
|
+
polytoken: "polytoken";
|
|
18
|
+
}>>;
|
|
19
|
+
remote: z.ZodOptional<z.ZodObject<{
|
|
20
|
+
host: z.ZodString;
|
|
21
|
+
directory: z.ZodString;
|
|
22
|
+
}, z.core.$strip>>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
type Runner = z.infer<typeof Runner>;
|
|
25
|
+
export declare function cloudRepository(remote: string): string;
|
|
26
|
+
export declare function prepareCloudWorktree(home: string, runner: Runner, offer: CloudOffer, runGit?: (cwd: string, args: string[]) => Promise<string>, packet?: RecoveryPacket): Promise<string>;
|
|
27
|
+
export declare function launchCloudOffer(paths: LorePaths, config: ConnectorConfig, runner: Runner, id: string, prepare?: typeof prepareCloudWorktree): Promise<void>;
|
|
28
|
+
export declare function pollCloudRunners(home: string): Promise<void>;
|
|
29
|
+
export declare function runCloudRecoveryCommand(args: readonly string[], paths: LorePaths, config: ConnectorConfig | null): Promise<void>;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=recovery-cloud.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recovery-cloud.d.ts","sourceRoot":"","sources":["../src/recovery-cloud.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAgE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AACnI,OAAO,EAAqC,KAAK,eAAe,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AASnG,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;iBAAyM,CAAC;AACtN,KAAK,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AAerC,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEtD;AACD,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,SAJ1E,MAAM,QAAQ,MAAM,EAAE,oBAI0D,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAgBlJ;AAcD,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,8BAAuB,iBAgC3I;AACD,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA6BlE;AACD,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAiCtI"}
|