copilot-operator 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +5 -1
  2. package/dist/src/api/operator.controller.js +44 -0
  3. package/dist/src/api/operator.service.js +50 -13
  4. package/dist/src/cli.js +1 -0
  5. package/dist/src/config/schema.js +33 -2
  6. package/dist/src/exec/authorizer.js +18 -8
  7. package/dist/src/exec/policyManifest.js +16 -2
  8. package/dist/src/orchestrator/taskRunner.js +27 -13
  9. package/dist/src/plan/importPlan.js +3 -2
  10. package/dist/src/plan/systemGuide.js +78 -6
  11. package/dist/src/session/compose.js +21 -2
  12. package/dist/src/session/store.js +51 -1
  13. package/dist/src/transport/chatSession.js +16 -4
  14. package/dist/src/vcs/taskVcs.js +5 -0
  15. package/dist/web/404.html +2 -2
  16. package/dist/web/_next/static/chunks/549-2086c05135bc9753.js +1 -0
  17. package/dist/web/_next/static/chunks/867-55627c5122ff6336.js +1 -0
  18. package/dist/web/_next/static/chunks/89-5585315f51e4c481.js +1 -0
  19. package/dist/web/_next/static/chunks/app/defaults/page-4ff25cafe6de779c.js +1 -0
  20. package/dist/web/_next/static/chunks/app/history/page-2232949a2ff8559e.js +1 -0
  21. package/dist/web/_next/static/chunks/app/import/page-8a4bdee8e38341a9.js +1 -0
  22. package/dist/web/_next/static/chunks/app/layout-92fa876afe619cf3.js +1 -0
  23. package/dist/web/_next/static/chunks/app/level1/page-697d4d6ba5bba41a.js +1 -0
  24. package/dist/web/_next/static/chunks/app/page-f04d6e00182ccc76.js +1 -0
  25. package/dist/web/_next/static/chunks/app/presets/page-e2dcb924d9e2d758.js +1 -0
  26. package/dist/web/_next/static/chunks/app/sessions/view/page-9dda275f4b1b0423.js +1 -0
  27. package/dist/web/_next/static/chunks/app/system/page-3aa2a0fef5454e69.js +1 -0
  28. package/dist/web/_next/static/css/{d77735cdc9020a86.css → 5a10c60adf9c5336.css} +1 -1
  29. package/dist/web/appearance.html +2 -2
  30. package/dist/web/appearance.txt +26 -25
  31. package/dist/web/defaults.html +2 -2
  32. package/dist/web/defaults.txt +26 -25
  33. package/dist/web/history.html +2 -2
  34. package/dist/web/history.txt +26 -25
  35. package/dist/web/import.html +2 -2
  36. package/dist/web/import.txt +26 -25
  37. package/dist/web/index.html +2 -2
  38. package/dist/web/index.txt +26 -25
  39. package/dist/web/level1.html +2 -2
  40. package/dist/web/level1.txt +26 -25
  41. package/dist/web/presets.html +2 -2
  42. package/dist/web/presets.txt +26 -25
  43. package/dist/web/sessions/view.html +2 -2
  44. package/dist/web/sessions/view.txt +26 -25
  45. package/dist/web/system.html +2 -2
  46. package/dist/web/system.txt +26 -25
  47. package/package.json +5 -3
  48. package/prompts/level1.md +17 -7
  49. package/dist/web/_next/static/chunks/643-34b9f66a6c317c4a.js +0 -1
  50. package/dist/web/_next/static/chunks/867-03b7cac8f79896c3.js +0 -1
  51. package/dist/web/_next/static/chunks/955-63de06e182d98949.js +0 -1
  52. package/dist/web/_next/static/chunks/app/defaults/page-ed858127cbdfb4ab.js +0 -1
  53. package/dist/web/_next/static/chunks/app/history/page-bad4f3e89b485719.js +0 -1
  54. package/dist/web/_next/static/chunks/app/import/page-db1f5f1ab2f5cad1.js +0 -1
  55. package/dist/web/_next/static/chunks/app/layout-72251c52cc54f95e.js +0 -1
  56. package/dist/web/_next/static/chunks/app/level1/page-cf3e50cf64fecf4f.js +0 -1
  57. package/dist/web/_next/static/chunks/app/page-6fd16e5c8cf3b20f.js +0 -1
  58. package/dist/web/_next/static/chunks/app/presets/page-951e78b80e0e22e6.js +0 -1
  59. package/dist/web/_next/static/chunks/app/sessions/view/page-f2e63618097d7221.js +0 -1
  60. package/dist/web/_next/static/chunks/app/system/page-44e7954c0e48f4ba.js +0 -1
  61. /package/dist/web/_next/static/{tMxWYVV0hUR9GoQZ96wFL → QwjyyBjkO5xlKFU5O6Wux}/_buildManifest.js +0 -0
  62. /package/dist/web/_next/static/{tMxWYVV0hUR9GoQZ96wFL → QwjyyBjkO5xlKFU5O6Wux}/_ssgManifest.js +0 -0
@@ -47,6 +47,8 @@ export class SessionStore {
47
47
  dir;
48
48
  sessionsDir;
49
49
  presetsDir;
50
+ /** Named personas the operator keeps for the import page, one file each. */
51
+ personasDir;
50
52
  level1Path;
51
53
  modelsPath;
52
54
  constructor(dataDir, defaultLevel1Path) {
@@ -54,6 +56,7 @@ export class SessionStore {
54
56
  this.dir = resolve(dataDir);
55
57
  this.sessionsDir = join(this.dir, 'sessions');
56
58
  this.presetsDir = join(this.dir, 'level2');
59
+ this.personasDir = join(this.dir, 'personas');
57
60
  this.level1Path = join(this.dir, 'level1.md');
58
61
  this.modelsPath = join(this.dir, 'models.json');
59
62
  }
@@ -134,6 +137,36 @@ export class SessionStore {
134
137
  async deletePreset(name) {
135
138
  await rm(join(this.presetsDir, `${safePresetName(name)}.md`), { force: true });
136
139
  }
140
+ // --- named personas -------------------------------------------------------------------
141
+ //
142
+ // "How the tasks are carried out" is one box on the import page, and the persona in it depends
143
+ // on the kind of work: a Playwright suite wants a different agent from an API service. These
144
+ // are saved copies of that box under a name, so switching is one choice instead of pasting a
145
+ // JSON back in. The box itself (`context-persona.md`) stays the one that is in force.
146
+ async listPersonas() {
147
+ const names = (await readdir(this.personasDir).catch(() => []))
148
+ .filter((n) => n.endsWith('.md'))
149
+ .sort((a, b) => a.localeCompare(b));
150
+ const out = [];
151
+ for (const n of names) {
152
+ const path = join(this.personasDir, n);
153
+ const content = await readFile(path, 'utf8');
154
+ const { mtime } = await import('node:fs').then((fs) => fs.statSync(path));
155
+ out.push({ name: n.slice(0, -3), content, updatedAt: mtime.toISOString() });
156
+ }
157
+ return out;
158
+ }
159
+ async savePersona(name, content) {
160
+ const safe = name.replace(/[^\p{L}\p{N}._ -]/gu, '').trim();
161
+ if (!safe)
162
+ throw new Error('The persona name is empty after removing unsafe characters.');
163
+ await mkdir(this.personasDir, { recursive: true });
164
+ await this.atomicWrite(join(this.personasDir, `${safePresetName(safe)}.md`), content);
165
+ return { name: safe, content, updatedAt: new Date().toISOString() };
166
+ }
167
+ async deletePersona(name) {
168
+ await rm(join(this.personasDir, `${safePresetName(name)}.md`), { force: true });
169
+ }
137
170
  // --- sessions -------------------------------------------------------------------------
138
171
  /**
139
172
  * Every session, newest first — by when it was made, not by what it is called.
@@ -258,7 +291,23 @@ export class SessionStore {
258
291
  * the retry destroys exactly the thing that made the retry interesting. The run folder of
259
292
  * the old attempt is untouched too, because the next attempt gets a folder of its own.
260
293
  */
261
- async rerunTask(sessionId, taskId, patch = {}) {
294
+ /**
295
+ * Queues a task that stopped at the runner's limit to carry on where it stopped: the same
296
+ * conversation, the same branch, a fresh count of messages. The attempt that stopped is kept on
297
+ * the record like any other.
298
+ */
299
+ async continueTask(sessionId, taskId) {
300
+ const current = (await this.getSession(sessionId))?.tasks.find((x) => x.id === taskId);
301
+ if (!current)
302
+ throw new Error(`Task ${taskId} does not exist in session ${sessionId}.`);
303
+ if (current.status !== 'limit-reached') {
304
+ throw new Error('Only a task that stopped at the runner\'s limit can be continued; run this one again instead.');
305
+ }
306
+ return await this.rerunTask(sessionId, taskId, {}, { fromAttempt: current.attempt ?? 1, stoppedBecause: current.reason });
307
+ }
308
+ async rerunTask(sessionId, taskId, patch = {},
309
+ /** Present when the new attempt carries on from the last one (see `continueTask`). */
310
+ continuing) {
262
311
  let result;
263
312
  await this.updateSession(sessionId, (s) => {
264
313
  const t = s.tasks.find((x) => x.id === taskId);
@@ -304,6 +353,7 @@ export class SessionStore {
304
353
  t.attempt = (t.attempt ?? 1) + 1;
305
354
  t.status = 'queued';
306
355
  t.iterations = 0;
356
+ t.continuing = continuing;
307
357
  // Cleared so the next run starts from nothing and gets its own run folder.
308
358
  t.runId = undefined;
309
359
  t.runGroup = undefined;
@@ -19,16 +19,28 @@ import { dirname } from 'node:path';
19
19
  /** The UI rejects anything longer. Verified live: "Your Copilot chat name can't be longer than 50 characters". */
20
20
  export const MAX_CHAT_NAME = 50;
21
21
  export const CHAT_URL_RE = /\/chat\/conversation\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i;
22
+ /**
23
+ * The short code a session's chats are named with: the random tail of its id
24
+ * (`20260928-073140-ujdt` gives `ujdt`), which the session page's address shows too.
25
+ *
26
+ * It replaced the date and time (`20260928-073140`), which took 15 of the 50 characters Copilot
27
+ * allows and left the session's own name 31; with the code it keeps 42 (asked for 2026-09-28).
28
+ * An id without such a tail gives its last six letters and digits.
29
+ */
30
+ export function chatCode(sessionId) {
31
+ const tail = /-([a-z0-9]{3,8})$/i.exec(sessionId)?.[1];
32
+ return (tail ?? sessionId.replace(/[^a-z0-9]/gi, '').slice(-6)).toLowerCase();
33
+ }
22
34
  /**
23
35
  * Builds the chat name. Shape:
24
36
  *
25
- * op/<runId>/<label>
37
+ * op/<code>/<label>
26
38
  *
27
39
  * The `op/` prefix makes every bot chat greppable in the sidebar and separates them from
28
- * the user's own chats. The run id ties the chat to the transcript on disk. The label is
29
- * whatever the run config calls the task.
40
+ * the user's own chats. The code ties the chat to its session (see `chatCode`). The label is
41
+ * the session's name.
30
42
  *
31
- * The whole thing is squeezed into 50 characters: the prefix and run id are kept intact
43
+ * The whole thing is squeezed into 50 characters: the prefix and the code are kept intact
32
44
  * because they are what makes the chat findable, and the label absorbs the truncation.
33
45
  */
34
46
  export function buildChatName(runId, label) {
@@ -57,6 +57,11 @@ export async function prepareForTask(session, task, bus, saveSession) {
57
57
  const wanted = plannedBranch
58
58
  ? plannedBranchName(plannedBranch, prefix, attempt)
59
59
  : branchNameFrom([session.name, task.title, attempt > 1 ? `a${attempt}` : undefined], prefix);
60
+ // A continuation carries on where the previous attempt stopped, on that attempt's own branch:
61
+ // its work is what is being continued. See `continueTask` in the store.
62
+ const previousBranch = task.continuing ? task.attempts?.at(-1)?.vcs?.branch : undefined;
63
+ if (previousBranch)
64
+ return await switchTo(session, task, dir, previousBranch, base, bus, { reuseExisting: true });
60
65
  // A re-run starts from where that task started the first time, not from where the previous
61
66
  // attempt ended. That is the whole point of recording the base commit.
62
67
  const from = firstAttemptBase(task) ?? base;
package/dist/web/404.html CHANGED
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html><!--tMxWYVV0hUR9GoQZ96wFL--><html lang="en" data-theme="light" data-textsize="normal" data-contrast="normal" data-motion="normal" data-links="plain" data-focus="normal"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/css/d77735cdc9020a86.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-0f31b926d9a9c5a4.js"/><script src="/_next/static/chunks/c7879cf7-b5ab1053c1d9a2e7.js" async=""></script><script src="/_next/static/chunks/131-bae98f790a541679.js" async=""></script><script src="/_next/static/chunks/main-app-e3a5f713ba31557e.js" async=""></script><script src="/_next/static/chunks/197-f7c33a0114fc3db3.js" async=""></script><script src="/_next/static/chunks/867-03b7cac8f79896c3.js" async=""></script><script src="/_next/static/chunks/643-34b9f66a6c317c4a.js" async=""></script><script src="/_next/static/chunks/app/layout-72251c52cc54f95e.js" async=""></script><meta name="robots" content="noindex"/><title>404: This page could not be found.</title><title>copilot-operator</title><meta name="description" content="Runs task loops with Microsoft 365 Copilot on this machine."/><script>
1
+ <!DOCTYPE html><!--QwjyyBjkO5xlKFU5O6Wux--><html lang="en" data-theme="light" data-textsize="normal" data-contrast="normal" data-motion="normal" data-links="plain" data-focus="normal"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/css/5a10c60adf9c5336.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-0f31b926d9a9c5a4.js"/><script src="/_next/static/chunks/c7879cf7-b5ab1053c1d9a2e7.js" async=""></script><script src="/_next/static/chunks/131-bae98f790a541679.js" async=""></script><script src="/_next/static/chunks/main-app-e3a5f713ba31557e.js" async=""></script><script src="/_next/static/chunks/197-f7c33a0114fc3db3.js" async=""></script><script src="/_next/static/chunks/867-55627c5122ff6336.js" async=""></script><script src="/_next/static/chunks/549-2086c05135bc9753.js" async=""></script><script src="/_next/static/chunks/app/layout-92fa876afe619cf3.js" async=""></script><meta name="robots" content="noindex"/><title>404: This page could not be found.</title><title>copilot-operator</title><meta name="description" content="Runs task loops with Microsoft 365 Copilot on this machine."/><script>
2
2
  (function () {
3
3
  try {
4
4
  var d = document.documentElement;
@@ -12,4 +12,4 @@
12
12
  d.dataset.focus = a.strongFocus ? 'strong' : 'normal';
13
13
  } catch (e) {}
14
14
  })();
15
- </script><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><a class="skip-link" href="#main">Skip to the content</a><div class="wrap"><header class="top"><h1><a href="/">copilot-operator</a></h1><nav aria-label="Main"><a href="/"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M4 5h16v4H4zM4 11h16v4H4zM4 17h10v2H4z"></path></svg><span>Sessions</span></a><a href="/defaults"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8zm8.5 4 1.5 1-1.6 2.8-1.8-.4a7 7 0 0 1-1.5 1.5l.4 1.8L14.7 21l-1-1.5a7 7 0 0 1-3.4 0l-1 1.5-2.8-1.6.4-1.8A7 7 0 0 1 5.4 16l-1.8.4L2 13.6 3.5 12.6V11.4L2 10.4l1.6-2.8 1.8.4A7 7 0 0 1 6.9 6.5l-.4-1.8L9.3 3l1 1.5a7 7 0 0 1 3.4 0l1-1.5 2.8 1.6-.4 1.8a7 7 0 0 1 1.5 1.5l1.8-.4L22 10.4l-1.5 1z"></path></svg><span>Settings</span></a><a href="/import"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 3v10m0 0 4-4m-4 4-4-4M4 15v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg><span>Plan from JSON</span></a><a href="/history"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 3a9 9 0 1 0 8.5 6M12 7v5l3 2M3 4v5h5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg><span>Task register</span></a><a href="/level1"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M6 3h9l5 5v13H6zM14 3v6h6M9 13h7M9 17h7" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"></path></svg><span>Level 1 prompt</span></a><a href="/presets"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M5 4h14v4H5zM5 10h14v4H5zM5 16h9v4H5z" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"></path></svg><span>Level 2 presets</span></a><a href="/appearance"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 3a9 9 0 0 0 0 18c1.5 0 2-1 2-2s-1-1.5-1-2.5S14 15 15.5 15H17a4 4 0 0 0 4-4 8 8 0 0 0-9-8zM8 9a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm4-3a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm4 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"></path></svg><span>Appearance</span></a><a href="/system"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M4 5h16v10H4zM2 19h20M9 15v4M15 15v4" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"></path></svg><span>System</span></a><select aria-label="Language" style="width:auto"><option value="en" selected="">English</option><option value="bg">Български</option></select></nav></header><main id="main"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--></main></div><script src="/_next/static/chunks/webpack-0f31b926d9a9c5a4.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[1205,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-03b7cac8f79896c3.js\",\"643\",\"static/chunks/643-34b9f66a6c317c4a.js\",\"177\",\"static/chunks/app/layout-72251c52cc54f95e.js\"],\"themeScript\"]\n3:I[1205,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-03b7cac8f79896c3.js\",\"643\",\"static/chunks/643-34b9f66a6c317c4a.js\",\"177\",\"static/chunks/app/layout-72251c52cc54f95e.js\"],\"AppearanceProvider\"]\n4:I[867,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-03b7cac8f79896c3.js\",\"643\",\"static/chunks/643-34b9f66a6c317c4a.js\",\"177\",\"static/chunks/app/layout-72251c52cc54f95e.js\"],\"LanguageProvider\"]\n5:I[1035,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-03b7cac8f79896c3.js\",\"643\",\"static/chunks/643-34b9f66a6c317c4a.js\",\"177\",\"static/chunks/app/layout-72251c52cc54f95e.js\"],\"DialogHost\"]\n6:I[8214,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-03b7cac8f79896c3.js\",\"643\",\"static/chunks/643-34b9f66a6c317c4a.js\",\"177\",\"static/chunks/app/layout-72251c52cc54f95e.js\"],\"SkipLink\"]\n7:I[8197,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-03b7cac8f79896c3.js\",\"643\",\"static/chunks/643-34b9f66a6c317c4a.js\",\"177\",\"static/chunks/app/layout-72251c52cc54f95e.js\"],\"\"]\n8:I[8214,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-03b7cac8f79896c3.js\",\"643\",\"static/chunks/643-34b9f66a6c317c4a.js\",\"177\",\"static/chunks/app/layout-72251c52cc54f95e.js\"],\"Nav\"]\n9:I[5204,[],\"\"]\na:I[2642,[],\"\"]\nb:I[433,[],\"OutletBoundary\"]\nd:I[9884,[],\"AsyncMetadataOutlet\"]\nf:I[433,[],\"ViewportBoundary\"]\n11:I[433,[],\"MetadataBoundary\"]\n12:\"$Sreact.suspense\"\n14:I[3536,[],\"\"]\n:HL[\"/_next/static/css/d77735cdc9020a86.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"tMxWYVV0hUR9GoQZ96wFL\",\"p\":\"\",\"c\":[\"\",\"_not-found\"],\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],[\"\",[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/d77735cdc9020a86.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"data-theme\":\"light\",\"data-textsize\":\"normal\",\"data-contrast\":\"normal\",\"data-motion\":\"normal\",\"data-links\":\"plain\",\"data-focus\":\"normal\",\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"$2\"}}]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"$L3\",null,{\"children\":[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$L5\",null,{\"children\":[[\"$\",\"$L6\",null,{}],[\"$\",\"div\",null,{\"className\":\"wrap\",\"children\":[[\"$\",\"header\",null,{\"className\":\"top\",\"children\":[[\"$\",\"h1\",null,{\"children\":[\"$\",\"$L7\",null,{\"href\":\"/\",\"children\":\"copilot-operator\"}]}],[\"$\",\"$L8\",null,{}]]}],[\"$\",\"main\",null,{\"id\":\"main\",\"children\":[\"$\",\"$L9\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$La\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]]}]]}]}]}]}]]}]]}],{\"children\":[\"/_not-found\",[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L9\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$La\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[\"__PAGE__\",[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$Lb\",null,{\"children\":[\"$Lc\",[\"$\",\"$Ld\",null,{\"promise\":\"$@e\"}]]}]]}],{},null,false]},null,false]},null,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[[\"$\",\"$Lf\",null,{\"children\":\"$L10\"}],null],[\"$\",\"$L11\",null,{\"children\":[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$12\",null,{\"fallback\":null,\"children\":\"$L13\"}]}]}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$14\",[]],\"s\":false,\"S\":true}\n"])</script><script>self.__next_f.push([1,"10:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\nc:null\n"])</script><script>self.__next_f.push([1,"e:{\"metadata\":[[\"$\",\"title\",\"0\",{\"children\":\"copilot-operator\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Runs task loops with Microsoft 365 Copilot on this machine.\"}]],\"error\":null,\"digest\":\"$undefined\"}\n"])</script><script>self.__next_f.push([1,"13:\"$e:metadata\"\n"])</script></body></html>
15
+ </script><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><a class="skip-link" href="#main">Skip to the content</a><div class="wrap"><header class="top"><h1><a href="/">copilot-operator</a></h1><nav aria-label="Main"><a href="/"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M4 5h16v4H4zM4 11h16v4H4zM4 17h10v2H4z"></path></svg><span>Sessions</span></a><a href="/defaults"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8zm8.5 4 1.5 1-1.6 2.8-1.8-.4a7 7 0 0 1-1.5 1.5l.4 1.8L14.7 21l-1-1.5a7 7 0 0 1-3.4 0l-1 1.5-2.8-1.6.4-1.8A7 7 0 0 1 5.4 16l-1.8.4L2 13.6 3.5 12.6V11.4L2 10.4l1.6-2.8 1.8.4A7 7 0 0 1 6.9 6.5l-.4-1.8L9.3 3l1 1.5a7 7 0 0 1 3.4 0l1-1.5 2.8 1.6-.4 1.8a7 7 0 0 1 1.5 1.5l1.8-.4L22 10.4l-1.5 1z"></path></svg><span>Settings</span></a><a href="/import"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 3v10m0 0 4-4m-4 4-4-4M4 15v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg><span>Plan from JSON</span></a><a href="/history"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 3a9 9 0 1 0 8.5 6M12 7v5l3 2M3 4v5h5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></svg><span>Task register</span></a><a href="/level1"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M6 3h9l5 5v13H6zM14 3v6h6M9 13h7M9 17h7" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"></path></svg><span>Level 1 prompt</span></a><a href="/presets"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M5 4h14v4H5zM5 10h14v4H5zM5 16h9v4H5z" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"></path></svg><span>Level 2 presets</span></a><a href="/appearance"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 3a9 9 0 0 0 0 18c1.5 0 2-1 2-2s-1-1.5-1-2.5S14 15 15.5 15H17a4 4 0 0 0 4-4 8 8 0 0 0-9-8zM8 9a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm4-3a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm4 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"></path></svg><span>Appearance</span></a><a href="/system"><svg class="nav-icon" viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M4 5h16v10H4zM2 19h20M9 15v4M15 15v4" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"></path></svg><span>System</span></a><select aria-label="Language" style="width:auto"><option value="en" selected="">English</option><option value="bg">Български</option></select></nav></header><main id="main"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--></main></div><script src="/_next/static/chunks/webpack-0f31b926d9a9c5a4.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[1205,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-55627c5122ff6336.js\",\"549\",\"static/chunks/549-2086c05135bc9753.js\",\"177\",\"static/chunks/app/layout-92fa876afe619cf3.js\"],\"themeScript\"]\n3:I[1205,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-55627c5122ff6336.js\",\"549\",\"static/chunks/549-2086c05135bc9753.js\",\"177\",\"static/chunks/app/layout-92fa876afe619cf3.js\"],\"AppearanceProvider\"]\n4:I[867,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-55627c5122ff6336.js\",\"549\",\"static/chunks/549-2086c05135bc9753.js\",\"177\",\"static/chunks/app/layout-92fa876afe619cf3.js\"],\"LanguageProvider\"]\n5:I[1035,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-55627c5122ff6336.js\",\"549\",\"static/chunks/549-2086c05135bc9753.js\",\"177\",\"static/chunks/app/layout-92fa876afe619cf3.js\"],\"DialogHost\"]\n6:I[8214,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-55627c5122ff6336.js\",\"549\",\"static/chunks/549-2086c05135bc9753.js\",\"177\",\"static/chunks/app/layout-92fa876afe619cf3.js\"],\"SkipLink\"]\n7:I[8197,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-55627c5122ff6336.js\",\"549\",\"static/chunks/549-2086c05135bc9753.js\",\"177\",\"static/chunks/app/layout-92fa876afe619cf3.js\"],\"\"]\n8:I[8214,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-55627c5122ff6336.js\",\"549\",\"static/chunks/549-2086c05135bc9753.js\",\"177\",\"static/chunks/app/layout-92fa876afe619cf3.js\"],\"Nav\"]\n9:I[6657,[\"197\",\"static/chunks/197-f7c33a0114fc3db3.js\",\"867\",\"static/chunks/867-55627c5122ff6336.js\",\"549\",\"static/chunks/549-2086c05135bc9753.js\",\"177\",\"static/chunks/app/layout-92fa876afe619cf3.js\"],\"GlobalApprovals\"]\na:I[5204,[],\"\"]\nb:I[2642,[],\"\"]\nc:I[433,[],\"OutletBoundary\"]\ne:I[9884,[],\"AsyncMetadataOutlet\"]\n10:I[433,[],\"ViewportBoundary\"]\n12:I[433,[],\"MetadataBoundary\"]\n13:\"$Sreact.suspense\"\n15:I[3536,[],\"\"]\n:HL[\"/_next/static/css/5a10c60adf9c5336.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"QwjyyBjkO5xlKFU5O6Wux\",\"p\":\"\",\"c\":[\"\",\"_not-found\"],\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],[\"\",[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/5a10c60adf9c5336.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"data-theme\":\"light\",\"data-textsize\":\"normal\",\"data-contrast\":\"normal\",\"data-motion\":\"normal\",\"data-links\":\"plain\",\"data-focus\":\"normal\",\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"$2\"}}]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"$L3\",null,{\"children\":[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$L5\",null,{\"children\":[[\"$\",\"$L6\",null,{}],[\"$\",\"div\",null,{\"className\":\"wrap\",\"children\":[[\"$\",\"header\",null,{\"className\":\"top\",\"children\":[[\"$\",\"h1\",null,{\"children\":[\"$\",\"$L7\",null,{\"href\":\"/\",\"children\":\"copilot-operator\"}]}],[\"$\",\"$L8\",null,{}]]}],[\"$\",\"$L9\",null,{}],[\"$\",\"main\",null,{\"id\":\"main\",\"children\":[\"$\",\"$La\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lb\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]]}]]}]}]}]}]]}]]}],{\"children\":[\"/_not-found\",[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$La\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lb\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[\"__PAGE__\",[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$Lc\",null,{\"children\":[\"$Ld\",[\"$\",\"$Le\",null,{\"promise\":\"$@f\"}]]}]]}],{},null,false]},null,false]},null,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[[\"$\",\"$L10\",null,{\"children\":\"$L11\"}],null],[\"$\",\"$L12\",null,{\"children\":[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$13\",null,{\"fallback\":null,\"children\":\"$L14\"}]}]}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$15\",[]],\"s\":false,\"S\":true}\n"])</script><script>self.__next_f.push([1,"11:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\nd:null\n"])</script><script>self.__next_f.push([1,"f:{\"metadata\":[[\"$\",\"title\",\"0\",{\"children\":\"copilot-operator\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Runs task loops with Microsoft 365 Copilot on this machine.\"}]],\"error\":null,\"digest\":\"$undefined\"}\n"])</script><script>self.__next_f.push([1,"14:\"$f:metadata\"\n"])</script></body></html>
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[549],{5549:(t,e,o)=>{o.d(e,{AV:()=>r,FH:()=>h,FZ:()=>d,aT:()=>c,c5:()=>y,dK:()=>m,nC:()=>s,rt:()=>l,ub:()=>i,zi:()=>p});var n=o(986);let s="/api";function c(t,e){return"/sessions/view?id=".concat(encodeURIComponent(t)).concat(e?"#".concat(e):"")}let a="cop-api-token";function r(){try{var t;let e=/(?:^#|&)token=([0-9a-f]{16,})/i.exec(window.location.hash);if(e)return window.localStorage.setItem(a,e[1]),window.history.replaceState(null,"",window.location.pathname+window.location.search),e[1];return window.localStorage.getItem(a)||(null!=(t=n.env.NEXT_PUBLIC_COP_TOKEN)?t:"")}catch(t){return""}}function i(t){let e=r();return e?"".concat(t).concat(t.includes("?")?"&":"?","token=").concat(encodeURIComponent(e)):t}let d=["exit-zero","exit-nonzero","output-contains","output-omits","output-matches","file-exists","file-missing","file-contains"];function l(t){return t.startsWith("exit-")||t.startsWith("output-")}function m(t){return"output-contains"===t||"output-omits"===t||"output-matches"===t||"file-contains"===t}async function u(t,e){var o;let n=await fetch("".concat(s).concat(t),{...e,headers:{"content-type":"application/json",...r()?{"x-cop-token":r()}:{},...null!=(o=null==e?void 0:e.headers)?o:{}}});if(!n.ok){let t="".concat(n.status," ").concat(n.statusText);try{let e=await n.json();(null==e?void 0:e.message)&&(t=Array.isArray(e.message)?e.message.join("; "):e.message)}catch(t){}throw Error(t)}let c=await n.text();return c?JSON.parse(c):void 0}let h={health:()=>u("/health"),doctor:()=>u("/doctor"),settings:()=>u("/settings"),saveSettings:t=>u("/settings",{method:"PUT",body:JSON.stringify(t)}),level1:()=>u("/level1"),setLevel1:t=>u("/level1",{method:"PUT",body:JSON.stringify({content:t})}),resetLevel1:()=>u("/level1",{method:"DELETE"}),presets:()=>u("/presets"),savePreset:(t,e)=>u("/presets/".concat(encodeURIComponent(t)),{method:"PUT",body:JSON.stringify({content:e})}),deletePreset:t=>u("/presets/".concat(encodeURIComponent(t)),{method:"DELETE"}),personas:()=>u("/personas"),savePersona:(t,e)=>u("/personas/".concat(encodeURIComponent(t)),{method:"PUT",body:JSON.stringify({content:e})}),deletePersona:t=>u("/personas/".concat(encodeURIComponent(t)),{method:"DELETE"}),sessions:()=>u("/sessions"),session:t=>u("/sessions/".concat(t)),createSession:(t,e)=>u("/sessions",{method:"POST",body:JSON.stringify({name:t,mirror:e})}),updateSession:(t,e)=>u("/sessions/".concat(t),{method:"PUT",body:JSON.stringify(e)}),deleteSession:t=>u("/sessions/".concat(t),{method:"DELETE"}),addTask:(t,e)=>u("/sessions/".concat(t,"/tasks"),{method:"POST",body:JSON.stringify(e)}),updateTask:(t,e,o)=>u("/sessions/".concat(t,"/tasks/").concat(e),{method:"PUT",body:JSON.stringify(o)}),deleteTask:(t,e)=>u("/sessions/".concat(t,"/tasks/").concat(e),{method:"DELETE"}),continueTask:(t,e)=>u("/sessions/".concat(t,"/tasks/").concat(e,"/continue"),{method:"POST",body:"{}"}),rerunTask:function(t,e){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u("/sessions/".concat(t,"/tasks/").concat(e,"/rerun"),{method:"POST",body:JSON.stringify(o)})},taskStory:(t,e,o)=>u("/sessions/".concat(t,"/tasks/").concat(e,"/story").concat(o?"?run=".concat(encodeURIComponent(o)):"")),taskFiles:(t,e,o)=>u("/sessions/".concat(t,"/tasks/").concat(e,"/files").concat(o?"?run=".concat(encodeURIComponent(o)):"")),taskLogUrl:(t,e,o)=>"".concat(s,"/sessions/").concat(t,"/tasks/").concat(e,"/log").concat(o?"?run=".concat(encodeURIComponent(o)):""),taskFileUrl:(t,e,o,n,c)=>"".concat(s,"/sessions/").concat(t,"/tasks/").concat(e,"/files/").concat(o,"/").concat(encodeURIComponent(n)).concat(c?"?run=".concat(encodeURIComponent(c)):""),saveTaskLog:(t,e,o)=>u("/sessions/".concat(t,"/tasks/").concat(e,"/log").concat(o?"?run=".concat(encodeURIComponent(o)):""),{method:"POST",body:"{}"}),saveTaskFile:(t,e,o,n,s)=>u("/sessions/".concat(t,"/tasks/").concat(e,"/files/").concat(o,"/").concat(encodeURIComponent(n)).concat(s?"?run=".concat(encodeURIComponent(s)):""),{method:"POST",body:"{}"}),start:(t,e,o)=>u("/sessions/".concat(t,"/start"),{method:"POST",body:JSON.stringify({mode:e,name:o})}),stop:t=>u("/sessions/".concat(t,"/stop"),{method:"POST",body:"{}"}),approvals:t=>u("/approvals".concat(t?"?session=".concat(encodeURIComponent(t)):"")),decide:(t,e)=>u("/approvals/".concat(t),{method:"POST",body:JSON.stringify({action:e})}),setRunMode:(t,e)=>u("/sessions/".concat(t,"/mode"),{method:"POST",body:JSON.stringify({mode:e})}),streamUrl:t=>i("".concat(s,"/sessions/").concat(t,"/stream")),batch:()=>u("/batch").then(t=>null!=t?t:null),startBatch:(t,e,o,n,s,c)=>u("/batch/start",{method:"POST",body:JSON.stringify({sessionIds:t,mode:e,onFailure:o,model:n,reviewModel:s,name:c})}),suggestedRunName:t=>u("/batch/name?sessions=".concat(encodeURIComponent(t.join(",")))),stopBatch:()=>u("/batch/stop",{method:"POST",body:"{}"}),pauseBatch:()=>u("/batch/pause",{method:"POST",body:"{}"}),resumeBatch:()=>u("/batch/resume",{method:"POST",body:"{}"}),planBrief:t=>u("/plan/brief?lang=".concat(encodeURIComponent(t))),context:(t,e)=>u("/context/".concat(t,"?lang=").concat(encodeURIComponent(e))),setContext:(t,e)=>u("/context/".concat(t),{method:"PUT",body:JSON.stringify({content:e})}),resetContext:(t,e)=>u("/context/".concat(t,"?lang=").concat(encodeURIComponent(e)),{method:"DELETE"}),checkPlan:t=>u("/plan/check",{method:"POST",body:JSON.stringify({text:t})}),importPlan:t=>u("/plan/import",{method:"POST",body:JSON.stringify({text:t})}),dirs:function(t){let e=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return u("/dirs?root=".concat(encodeURIComponent(t),"&gitignore=").concat(e?"1":"0"))},browseFolder:t=>u("/browse-folder",{method:"POST",body:JSON.stringify({start:t})}),previewMirror:t=>u("/mirror/preview",{method:"POST",body:JSON.stringify(t)}),tasks:()=>u("/tasks"),activity:()=>u("/activity"),downloadBundle:async t=>{var e,o,n;let c=await fetch("".concat(s,"/export/bundle"),{method:"POST",headers:{"content-type":"application/json",...r()?{"x-cop-token":r()}:{}},body:JSON.stringify({tasks:t})});if(!c.ok)throw Error(await c.text()||"".concat(c.status," ").concat(c.statusText));let a=null!=(n=c.headers.get("content-disposition"))?n:"",i=null==(e=/filename\*=UTF-8''([^;]+)/i.exec(a))?void 0:e[1],d=null==(o=/filename="([^"]+)"/i.exec(a))?void 0:o[1],l=null!=d?d:"copilot-operator-bundle.json";if(i)try{l=decodeURIComponent(i)}catch(t){}let m=URL.createObjectURL(await c.blob()),u=document.createElement("a");return u.href=m,u.download=l,document.body.appendChild(u),u.click(),u.remove(),setTimeout(()=>URL.revokeObjectURL(m),1e4),l},exportUrl:(t,e)=>{let o=new URLSearchParams;return e.run&&o.set("run",e.run),e.session&&o.set("session",e.session),e.task&&o.set("task",e.task),i("".concat(s,"/export/").concat(t,"?").concat(o.toString()))},debugExportUrl:t=>i("".concat(s,"/debug/export").concat(t.length>0?"?sessions=".concat(encodeURIComponent(t.join(","))):"")),vcsStatus:t=>u("/sessions/".concat(t,"/vcs")),restorePreview:(t,e)=>u("/sessions/".concat(t,"/tasks/").concat(e,"/restore")),restore:(t,e)=>u("/sessions/".concat(t,"/tasks/").concat(e,"/restore"),{method:"POST",body:"{}"}),restartPlan:(t,e)=>u("/sessions/".concat(t,"/tasks/").concat(e,"/restart")),restartFrom:function(t,e){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return u("/sessions/".concat(t,"/tasks/").concat(e,"/restart"),{method:"POST",body:JSON.stringify(o)})},repoCheck:t=>u("/repo?dir=".concat(encodeURIComponent(t))),project:()=>u("/project"),setProject:t=>u("/project",{method:"PUT",body:JSON.stringify(t)}),models:()=>u("/models"),setDefaultModel:t=>u("/models/default",{method:"PUT",body:JSON.stringify({model:t})}),setDefaultReviewModel:t=>u("/models/review-default",{method:"PUT",body:JSON.stringify({model:t})}),refreshModels:()=>u("/models/refresh",{method:"POST",body:"{}"})};function p(t){return t<1024?"".concat(t," B"):t<1048576?"".concat((t/1024).toFixed(1)," KB"):"".concat((t/1048576).toFixed(1)," MB")}function y(t){if(void 0===t)return"";let e=Math.round(t/1e3);if(e<60)return"".concat(e,"s");let o=Math.floor(e/60);return o<60?"".concat(o,"m ").concat(e%60,"s"):"".concat(Math.floor(o/60),"h ").concat(o%60,"m")}}}]);