dsh-multigameassistant 2.0.1 → 2.0.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.
@@ -3,12 +3,12 @@ import {
3
3
  globToRegExp,
4
4
  renderTask,
5
5
  require_dist
6
- } from "./chunk-J46OASOG.js";
6
+ } from "./chunk-OQZ2XZVP.js";
7
7
  import {
8
8
  RUNS_CAPABILITY,
9
9
  ScriptId,
10
10
  external_exports
11
- } from "./chunk-HPQCV6WO.js";
11
+ } from "./chunk-IH3K4QPN.js";
12
12
  import {
13
13
  __toESM
14
14
  } from "./chunk-2UFLGPDY.js";
@@ -1698,7 +1698,9 @@ var Runner = class {
1698
1698
  this.#line(run, "adg", `\u5DF2\u66F4\u65B0\u5230 ${result.version}`);
1699
1699
  else if (result.state === "current")
1700
1700
  this.#line(run, "adg", "\u5DF2\u662F\u6700\u65B0\u7248\u672C");
1701
- else if (result.state === "failed") {
1701
+ else if (result.state === "available") {
1702
+ this.#line(run, "adg", result.policy === "ask" ? `\u6709\u65B0\u7248\u672C ${result.version}\uFF1A\u8BBE\u7F6E\u4E3A\u5148\u95EE\u4F60\u518D\u66F4\u65B0\uFF0C\u8FD9\u6B21\u7528\u73B0\u6709\u7248\u672C\u8FD0\u884C` : `\u6709\u65B0\u7248\u672C ${result.version}\uFF1A\u8BBE\u7F6E\u4E3A\u4E0D\u81EA\u52A8\u66F4\u65B0\uFF0C\u8FD9\u6B21\u7528\u73B0\u6709\u7248\u672C\u8FD0\u884C`);
1703
+ } else if (result.state === "failed") {
1702
1704
  const text = `\u66F4\u65B0\u5931\u8D25\uFF0C\u5148\u7528\u73B0\u6709\u7248\u672C${script.current === void 0 ? "" : ` ${script.current} `}\u8FD0\u884C\uFF1A${result.error}`;
1703
1705
  run.info.warnings.push(text);
1704
1706
  this.#line(run, "adg", text);
@@ -14779,6 +14779,7 @@ var ScriptJob = external_exports.object({
14779
14779
  startedAt: external_exports.number(),
14780
14780
  endedAt: external_exports.number().optional()
14781
14781
  });
14782
+ var ScriptUpdatePolicy = external_exports.enum(["auto", "ask", "off"]);
14782
14783
  var InstallSettings = external_exports.object({
14783
14784
  /** GitHub REST API base. */
14784
14785
  apiBase: external_exports.url({ protocol: /^https?$/ }),
@@ -14796,7 +14797,9 @@ var InstallSettings = external_exports.object({
14796
14797
  /** Offer pre-releases when no stable release exists. */
14797
14798
  includePrereleases: external_exports.boolean(),
14798
14799
  /** Credential holding the user's Mirror酱 CDK: scripts published there update from it (incremental when possible). */
14799
- cdkRef: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/)
14800
+ cdkRef: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/),
14801
+ /** What happens when a script has a newer version. */
14802
+ autoUpdate: ScriptUpdatePolicy
14800
14803
  });
14801
14804
  var Empty = external_exports.object({});
14802
14805
  var ById = external_exports.object({ id: ScriptId });
@@ -15829,12 +15832,32 @@ var Activity = external_exports.object({
15829
15832
  kind: external_exports.string().optional(),
15830
15833
  /** What it is about, from the data site. */
15831
15834
  description: external_exports.string().optional(),
15832
- /** Its picture (an https address; fetch it with `games/image`). */
15835
+ /**
15836
+ * Its picture (fetch it with `games/image`). Unless the user chose a source
15837
+ * (`chosen`), by rank: what the user set, then what a source gives (data
15838
+ * sites, then web pages), then the screenshot the agent read it from.
15839
+ */
15833
15840
  cover: external_exports.string().optional(),
15834
15841
  /** The source whose dates are shown: a data site, else the newest web page the agent read. */
15835
15842
  site: external_exports.object({ source: external_exports.string(), name: external_exports.string(), at: external_exports.number() }).optional(),
15836
- /** Every source that lists it (data sites, web pages the agent read), with the end each gives. */
15837
- sources: external_exports.array(external_exports.object({ id: external_exports.string(), name: external_exports.string(), at: external_exports.number(), web: external_exports.boolean(), endsAt: external_exports.number().optional() })).optional(),
15843
+ /** Every source that lists it (data sites, web pages the agent read), with what each says. */
15844
+ sources: external_exports.array(external_exports.object({
15845
+ id: external_exports.string(),
15846
+ name: external_exports.string(),
15847
+ at: external_exports.number(),
15848
+ web: external_exports.boolean(),
15849
+ startsAt: external_exports.number().optional(),
15850
+ endsAt: external_exports.number().optional(),
15851
+ shopEndsAt: external_exports.number().optional(),
15852
+ cover: external_exports.string().optional()
15853
+ })).optional(),
15854
+ /**
15855
+ * The source the user picked for the picture and the dates (`games/activity/source`):
15856
+ * a source's id, `OWN_SOURCE` or `SCREEN_SOURCE`. Absent: the default order.
15857
+ */
15858
+ chosen: external_exports.string().optional(),
15859
+ /** Which source each shown value comes from, in the same ids as `chosen`. */
15860
+ shown: external_exports.object({ cover: external_exports.string().optional(), startsAt: external_exports.string().optional(), endsAt: external_exports.string().optional() }).optional(),
15838
15861
  /** Read from the game screen by the agent. */
15839
15862
  screen: external_exports.object({
15840
15863
  at: external_exports.number(),
@@ -15864,8 +15887,16 @@ var Activity = external_exports.object({
15864
15887
  * those fields beat every source, and a refresh never changes or drops them.
15865
15888
  * An activity with no `sources` and no `screen` is one the user added.
15866
15889
  */
15867
- own: external_exports.object({ at: external_exports.number(), fields: external_exports.array(external_exports.enum(["name", "startsAt", "endsAt", "kind", "description", "url", "cover"])) }).optional()
15890
+ own: external_exports.object({
15891
+ at: external_exports.number(),
15892
+ fields: external_exports.array(external_exports.enum(["name", "startsAt", "endsAt", "kind", "description", "url", "cover"])),
15893
+ startsAt: external_exports.number().optional(),
15894
+ endsAt: external_exports.number().optional(),
15895
+ cover: external_exports.string().optional()
15896
+ }).optional()
15868
15897
  });
15898
+ var OWN_SOURCE = "@own";
15899
+ var SCREEN_SOURCE = "@screen";
15869
15900
  var MAX_ACTIVITY_IMAGE_BASE64 = 112e5;
15870
15901
  var ActivityImage = external_exports.object({
15871
15902
  mediaType: external_exports.enum(["image/png", "image/jpeg", "image/gif", "image/webp", "image/avif"]),
@@ -16092,6 +16123,16 @@ var GamesRequests = {
16092
16123
  }),
16093
16124
  result: Activity
16094
16125
  },
16126
+ /**
16127
+ * Which source an event's picture and dates come from: a source's id,
16128
+ * `OWN_SOURCE` or `SCREEN_SOURCE`; `null` goes back to the default order.
16129
+ * What that source does not say still comes from the default order.
16130
+ */
16131
+ "games/activity/source": {
16132
+ capability: GAMES_CAPABILITY,
16133
+ params: external_exports.object({ activityId: external_exports.string(), source: external_exports.string().nullable() }),
16134
+ result: Activity
16135
+ },
16095
16136
  /** Take back everything the user wrote on an event: the sources' word shows again; one only the user added goes. */
16096
16137
  "games/activity/reset": {
16097
16138
  capability: GAMES_CAPABILITY,
@@ -16307,26 +16348,39 @@ var SkillsNotifications = {
16307
16348
  // packages/protocol/lib/persona.js
16308
16349
  var PERSONA_CAPABILITY = "persona";
16309
16350
  var PersonaStyle = external_exports.enum(["default", "concise", "patient", "lively", "buddy", "butler"]);
16351
+ var PeerStyle = external_exports.enum(["plain", "same"]);
16310
16352
  var Persona = external_exports.object({
16311
16353
  style: PersonaStyle,
16312
- /** What the agent calls itself. */
16313
- name: external_exports.string().max(20).optional(),
16314
16354
  /** How it addresses the user ("主人", "指挥官"…). */
16315
16355
  callUser: external_exports.string().max(20).optional(),
16316
16356
  /** Anything else, in the user's words. */
16317
- custom: external_exports.string().optional()
16357
+ custom: external_exports.string().optional(),
16358
+ peerStyle: PeerStyle.optional()
16359
+ });
16360
+ var PersonaOverride = Persona.partial().extend({
16361
+ /** What the agent calls itself. */
16362
+ name: external_exports.string().max(20).optional()
16363
+ });
16364
+ var PersonaSettings = external_exports.object({
16365
+ persona: Persona,
16366
+ agents: external_exports.record(external_exports.string(), PersonaOverride)
16367
+ });
16368
+ var PersonaAnswer = PersonaSettings.extend({
16369
+ /** The text added to the system prompt with nothing of an agent's own, for the settings page to show. */
16370
+ prompt: external_exports.string(),
16371
+ /** The same, as it is for each agent, by id. */
16372
+ prompts: external_exports.record(external_exports.string(), external_exports.string())
16318
16373
  });
16319
16374
  var PersonaRequests = {
16320
16375
  "persona/get": {
16321
16376
  capability: PERSONA_CAPABILITY,
16322
16377
  params: external_exports.object({}),
16323
- /** `prompt`: the text added to the system prompt, for the settings page to show. */
16324
- result: external_exports.object({ persona: Persona, prompt: external_exports.string() })
16378
+ result: PersonaAnswer
16325
16379
  },
16326
16380
  "persona/set": {
16327
16381
  capability: PERSONA_CAPABILITY,
16328
- params: external_exports.object({ persona: Persona }),
16329
- result: external_exports.object({ persona: Persona, prompt: external_exports.string() })
16382
+ params: PersonaSettings,
16383
+ result: PersonaAnswer
16330
16384
  }
16331
16385
  };
16332
16386
 
@@ -16975,8 +17029,22 @@ var ModelSelection = external_exports.object({
16975
17029
  reasoningEffort: external_exports.string().optional()
16976
17030
  });
16977
17031
  var AGENTS_CAPABILITY = "agents";
17032
+ var ThreadMessage = external_exports.object({
17033
+ /** Who said it, by name. */
17034
+ from: external_exports.string(),
17035
+ /** `question` waits for an answer; `update` only informs, and reaches the other side at once; `done` is the conclusion. */
17036
+ kind: external_exports.enum(["question", "answer", "update", "done"]),
17037
+ text: external_exports.string(),
17038
+ at: external_exports.number()
17039
+ });
16978
17040
  var HandOff = external_exports.object({
16979
17041
  id: external_exports.string(),
17042
+ /** What the two have said since the work was handed over (docs/design/agent-roles.md §14.3). */
17043
+ messages: external_exports.array(ThreadMessage).optional(),
17044
+ /** The agents the work has passed through, first asker first (ids); a chain does not come back on itself. */
17045
+ chain: external_exports.array(external_exports.string()).optional(),
17046
+ /** The hand-off this one was opened from inside of. */
17047
+ parent: external_exports.string().optional(),
16980
17048
  /** The conversation that asked, where the reply goes back. */
16981
17049
  fromSession: external_exports.string(),
16982
17050
  /** 助手's `agent_delegate` call that asked; absent: the app asked (`by`). */
@@ -16989,7 +17057,8 @@ var HandOff = external_exports.object({
16989
17057
  title: external_exports.string(),
16990
17058
  task: external_exports.string(),
16991
17059
  expecting: external_exports.string().optional(),
16992
- state: external_exports.enum(["running", "done", "failed"]),
17060
+ /** `waiting`: the agent doing it asked something and waits for the answer. */
17061
+ state: external_exports.enum(["running", "waiting", "done", "failed"]),
16993
17062
  /** Its reply; for a failure, why. */
16994
17063
  reply: external_exports.string().optional(),
16995
17064
  startedAt: external_exports.number(),
@@ -17125,7 +17194,19 @@ var Requests = {
17125
17194
  params: external_exports.object({ sessionId: external_exports.string() }),
17126
17195
  result: external_exports.object({ items: external_exports.array(HandOff) })
17127
17196
  },
17197
+ /** Stop a sub-agent's current work (the parent's own turn goes on). */
17198
+ "subagents/stop": {
17199
+ capability: AGENTS_CAPABILITY,
17200
+ params: external_exports.object({ sessionId: external_exports.string() }),
17201
+ result: Accepted
17202
+ },
17128
17203
  /** One hand-off, for the page that shows what the two agents said. */
17204
+ /** All that two agents have said to each other, oldest first: one conversation, whatever each thread was about. */
17205
+ "handoffs/between": {
17206
+ capability: AGENTS_CAPABILITY,
17207
+ params: external_exports.object({ a: external_exports.string(), b: external_exports.string() }),
17208
+ result: external_exports.object({ items: external_exports.array(HandOff) })
17209
+ },
17129
17210
  "handoffs/get": {
17130
17211
  capability: AGENTS_CAPABILITY,
17131
17212
  params: external_exports.object({ id: external_exports.string() }),
@@ -17296,6 +17377,29 @@ var Requests = {
17296
17377
  params: external_exports.object({ ref: CredentialRef }),
17297
17378
  result: Empty2
17298
17379
  },
17380
+ /**
17381
+ * Which build serves this host, for 设置 → 关于: `plugin` is the dsh plugin package (dsh-multigameassistant),
17382
+ * with its version; anything else (the desktop app, a checkout) says so through its own means.
17383
+ */
17384
+ "about/info": {
17385
+ capability: "about",
17386
+ params: Empty2,
17387
+ result: external_exports.object({ edition: external_exports.enum(["plugin", "other"]), version: external_exports.string().optional() })
17388
+ },
17389
+ /**
17390
+ * The plugin package's newest release on GitHub, if newer than this one (a pre-release only for a
17391
+ * pre-release). `onNpm`: npm already serves it under the plugin's name (a release is live there only
17392
+ * once approved); undefined when npm could not be asked. Only the plugin package checks here.
17393
+ */
17394
+ "about/checkUpdate": {
17395
+ capability: "about",
17396
+ params: Empty2,
17397
+ result: external_exports.object({
17398
+ current: external_exports.string(),
17399
+ latest: external_exports.object({ version: external_exports.string(), prerelease: external_exports.boolean(), notesUrl: external_exports.string(), onNpm: external_exports.boolean().optional() }).optional(),
17400
+ checkedAt: external_exports.number()
17401
+ })
17402
+ },
17299
17403
  "providers/list": {
17300
17404
  capability: "providers",
17301
17405
  params: Empty2,
@@ -17473,15 +17577,24 @@ function classify(value) {
17473
17577
  // packages/protocol/lib/handoff-notes.js
17474
17578
  var BY_YOU = "\u4F60";
17475
17579
  var QUIET = "\uFF08\u4E0D\u7528\u544A\u8BC9\u7528\u6237\uFF09";
17580
+ var wordsOf = (text) => text.replace(/[^\p{Script=Han}a-zA-Z0-9]/gu, "");
17476
17581
  function isQuiet(text) {
17477
- return text.replace(/[。.\s]/g, "") === QUIET;
17478
- }
17479
- var RETURNS = "\uFF08\u505A\u5B8C\u540E\u4F60\u8FD9\u4E00\u8F6E\u7684\u6700\u540E\u4E00\u6BB5\u56DE\u590D\u4F1A\u539F\u6837\u4EA4\u56DE\u53BB\uFF1A\u628A\u7ED3\u8BBA\u5199\u5728\u90A3\u91CC\u3002\uFF09";
17480
- function taskMessage(by, title, body, returns = false) {
17582
+ return wordsOf(text) === wordsOf(QUIET);
17583
+ }
17584
+ var RETURNS = "\uFF08\u4F60\u8FD9\u4E00\u8F6E\u7684\u6700\u540E\u4E00\u6BB5\u56DE\u590D\u4F1A\u4F5C\u4E3A\u7ED3\u8BBA\u4EA4\u56DE\u53BB\u3002\u5728\u90A3\u4E4B\u524D\u8981\u8BA9\u5BF9\u65B9\u77E5\u9053\u7684\uFF0C\u7528 agent_message \u7684 update \u8BF4\uFF0C\u9A6C\u4E0A\u9001\u5230\uFF0C\u8BF4\u51E0\u6B21\u90FD\u884C\uFF1B\u4EA4\u56DE\u7ED3\u8BBA\u4EE5\u540E\u8FD8\u6709\u8BDD\uFF0C\u540C\u6837\u53D1\u5230\u8FD9\u6761\u7EBF\u7D22\uFF1A\u4F60\u7684\u666E\u901A\u56DE\u590D\u5BF9\u65B9\u770B\u4E0D\u5230\u3002\uFF09";
17585
+ var RETURNS_BEFORE = "\uFF08\u505A\u5B8C\u540E\u4F60\u8FD9\u4E00\u8F6E\u7684\u6700\u540E\u4E00\u6BB5\u56DE\u590D\u4F1A\u539F\u6837\u4EA4\u56DE\u53BB\uFF1A\u628A\u7ED3\u8BBA\u5199\u5728\u90A3\u91CC\u3002\uFF09";
17586
+ var THREAD_LINE = /^(这件事的线索是 (\S+):做的过程中要问清楚什么,用 agent_message 问,thread 填它;不要猜。)$/;
17587
+ var PAST_HEAD = (who) => `\uFF08\u4F60\u548C${who}\u4E4B\u524D\u7684\u6765\u5F80\uFF0C\u4ECE\u65E7\u5230\u65B0\u3002\u53EF\u80FD\u5DF2\u7ECF\u8FC7\u65F6\uFF1B\u8981\u770B\u5B8C\u6574\u7684\uFF0C\u7528 agent_threads \u5E26 id\uFF1A`;
17588
+ var PAST_LINE = /^(你和.{1,20}之前的来往,/;
17589
+ var PAST_END = "\uFF09";
17590
+ function taskMessage(by, title, body, returns = false, thread, past) {
17481
17591
  const head = by === BY_YOU ? `\uFF08\u4F60\u5728\u8F6F\u4EF6\u91CC\u70B9\u7684\uFF1A${oneLine(title)}\uFF09` : `\uFF08${by}\u4EA4\u7ED9\u4F60\u7684\u4E8B\uFF1A${oneLine(title)}\uFF09`;
17592
+ const notes = [...returns ? [RETURNS] : [], ...thread === void 0 ? [] : [`\uFF08\u8FD9\u4EF6\u4E8B\u7684\u7EBF\u7D22\u662F ${thread}\uFF1A\u505A\u7684\u8FC7\u7A0B\u4E2D\u8981\u95EE\u6E05\u695A\u4EC0\u4E48\uFF0C\u7528 agent_message \u95EE\uFF0Cthread \u586B\u5B83\uFF1B\u4E0D\u8981\u731C\u3002\uFF09`]];
17593
+ if (past !== void 0 && past.lines.length > 0)
17594
+ notes.push([PAST_HEAD(past.who), ...past.lines, PAST_END].join("\n"));
17482
17595
  return `${head}
17483
- ${returns ? `${RETURNS}
17484
- ` : ""}
17596
+ ${notes.map((n) => `${n}
17597
+ `).join("")}
17485
17598
  ${body}`;
17486
17599
  }
17487
17600
  function parseTask(text) {
@@ -17490,23 +17603,69 @@ function parseTask(text) {
17490
17603
  const theirs = mine === null ? /^(([^():]{1,20})交给你的事:(.*))$/.exec(first) : null;
17491
17604
  if (mine === null && theirs === null)
17492
17605
  return void 0;
17493
- const returns = rest[0] === RETURNS;
17606
+ const returns = rest[0] === RETURNS || rest[0] === RETURNS_BEFORE;
17607
+ const after = returns ? rest.slice(1) : rest;
17608
+ const thread = THREAD_LINE.exec(after[0] ?? "")?.[1];
17609
+ const next = thread === void 0 ? after : after.slice(1);
17610
+ const pastEnd = PAST_LINE.test(next[0] ?? "") ? next.indexOf(PAST_END) : -1;
17494
17611
  return {
17495
17612
  by: mine !== null ? BY_YOU : theirs[1],
17496
17613
  title: mine !== null ? mine[1] : theirs[2],
17497
17614
  returns,
17498
- body: (returns ? rest.slice(1) : rest).join("\n").trim()
17499
- };
17615
+ ...thread === void 0 ? {} : { thread },
17616
+ body: next.slice(pastEnd + 1).join("\n").trim()
17617
+ };
17618
+ }
17619
+ var THREAD_WORDS = { question: "\u95EE\u4F60", answer: "\u56DE\u7B54\u4E86\u4F60", update: "\u544A\u8BC9\u4F60" };
17620
+ function threadTail(kind, thread, reader, closed) {
17621
+ const person = `\u770B\u60C5\u51B5\u544A\u8BC9\u7528\u6237\uFF1A\u6709\u7528\u6237\u8BE5\u77E5\u9053\u7684\uFF0C\u4E00\u4E24\u53E5\u8BDD\u8BF4\u8981\u70B9\uFF1B\u6CA1\u6709\u7684\u8BDD\u6574\u6BB5\u56DE\u590D\u53EA\u5199\u300C${QUIET}\u300D\u3002`;
17622
+ if (closed) {
17623
+ if (kind === "question")
17624
+ return `\uFF08\u8FD9\u4EF6\u4E8B\u5DF2\u7ECF\u4EA4\u56DE\u4E86\uFF0C\u8FD9\u662F\u540E\u9762\u7684\u8BDD\u3002\u8981\u56DE\u7B54\u7684\u8BDD\u7528 agent_message\uFF1Athread \u586B ${thread}\uFF0Ckind \u586B answer\uFF0C\u4F60\u7684\u666E\u901A\u56DE\u590D\u5BF9\u65B9\u770B\u4E0D\u5230\u3002\uFF09`;
17625
+ return reader === "main" ? `\uFF08\u8FD9\u4EF6\u4E8B\u5DF2\u7ECF\u4EA4\u56DE\u4E86\uFF0C\u8FD9\u662F\u540E\u9762\u8865\u7684\u8BDD\uFF0C\u4E0D\u7528\u56DE\u5B83\u3002${person}\uFF09` : "\uFF08\u8FD9\u4EF6\u4E8B\u5DF2\u7ECF\u4EA4\u56DE\u4E86\uFF0C\u8FD9\u662F\u540E\u9762\u8865\u7684\u8BDD\uFF0C\u4E0D\u7528\u56DE\u5B83\u3002\uFF09";
17626
+ }
17627
+ if (kind === "question")
17628
+ return `\uFF08\u5BF9\u65B9\u5728\u7B49\uFF1A\u5148\u56DE\u7B54\u5B83\uFF0C\u518D\u63A5\u7740\u505A\u624B\u4E0A\u7684\u4E8B\u3002\u7528 agent_message \u56DE\u7B54\uFF1Athread \u586B ${thread}\uFF0Ckind \u586B answer\u3002\u4F60\u8FD9\u4E00\u8F6E\u7684\u6700\u540E\u4E00\u6BB5\u56DE\u590D\u4E5F\u7B97\u56DE\u7B54\u3002\u8981\u7B49\u7528\u6237\u51B3\u5B9A\u7684\u8BDD\uFF0C\u5148\u7528 kind: update \u8BF4\u4E00\u58F0\uFF0C\u7B49\u6709\u4E86\u7ED3\u679C\u518D\u56DE\u7B54\u3002\uFF09`;
17629
+ if (kind === "answer" || reader === "worker")
17630
+ return "\uFF08\u63A5\u7740\u505A\u8FD9\u4EF6\u4E8B\u3002\uFF09";
17631
+ return reader === "main" ? `\uFF08\u5B83\u8FD8\u5728\u505A\uFF0C\u8FD9\u662F\u8FC7\u7A0B\u4E2D\u544A\u8BC9\u4F60\u7684\uFF0C\u4E0D\u7528\u56DE\u5B83\u3002${person}\uFF09` : "\uFF08\u5B83\u8FD8\u5728\u505A\uFF0C\u8FD9\u662F\u8FC7\u7A0B\u4E2D\u544A\u8BC9\u4F60\u7684\uFF0C\u4E0D\u7528\u56DE\u5B83\uFF1A\u63A5\u7740\u505A\u4F60\u624B\u4E0A\u7684\u4E8B\u3002\uFF09";
17632
+ }
17633
+ function threadMessage(input) {
17634
+ const head = `\uFF08\u300C${input.from}\u300D\u5728\u7EBF\u7D22 ${input.thread} \u91CC${THREAD_WORDS[input.kind]}\uFF1A${oneLine(input.title)}\uFF09`;
17635
+ return `${head}
17636
+
17637
+ ${input.text.trim()}
17638
+
17639
+ ${threadTail(input.kind, input.thread, input.reader ?? "worker", input.closed === true)}`;
17640
+ }
17641
+ function parseThreadNote(text) {
17642
+ const [first = "", ...rest] = text.split("\n");
17643
+ const head = /^(「([^」]+)」在线索 (\S+) 里(问你|回答了你|告诉你):(.*))$/.exec(first);
17644
+ if (head === null)
17645
+ return void 0;
17646
+ const body = rest.join("\n").trim();
17647
+ const end = body.lastIndexOf("\n\n\uFF08");
17648
+ return { from: head[1], thread: head[2], kind: head[3] === "\u95EE\u4F60" ? "question" : head[3] === "\u544A\u8BC9\u4F60" ? "update" : "answer", title: head[4], text: (end === -1 ? body : body.slice(0, end)).trim() };
17500
17649
  }
17501
17650
  function relayMessage(input) {
17502
17651
  const head = `\uFF08\u300C${input.agent}\u300D${input.ok ? "\u4EA4\u56DE\u4E86" : "\u6CA1\u6709\u505A\u5B8C"}${input.asker}\u4EA4\u7ED9\u5B83\u7684\u4E8B\uFF1A${oneLine(input.title)}\uFF09`;
17503
- const tail = input.ok ? `\uFF08\u770B\u60C5\u51B5\u544A\u8BC9\u7528\u6237\uFF1A\u6709\u7528\u6237\u8BE5\u77E5\u9053\u6216\u8981\u505A\u7684\uFF0C\u7528\u4E00\u4E24\u53E5\u8BDD\u8BF4\u8981\u70B9\uFF0C\u5B8C\u6574\u8FC7\u7A0B\u5728\u300C${input.agent}\u300D\u7684\u5BF9\u8BDD\u91CC\uFF1B\u6CA1\u6709\u7684\u8BDD\u6574\u6BB5\u56DE\u590D\u53EA\u5199\u300C${QUIET}\u300D\u3002\u8FD8\u8981\u522B\u7684 agent \u63A5\u7740\u505A\u7684\uFF0C\u53EF\u4EE5\u518D\u4EA4\u3002\uFF09` : `\uFF08\u544A\u8BC9\u7528\u6237\u54EA\u91CC\u6CA1\u505A\u6210\u3001\u4E3A\u4EC0\u4E48\uFF1B\u9700\u8981\u7684\u8BDD\u6362\u4E2A\u8BF4\u6CD5\u518D\u4EA4\u4E00\u6B21\uFF0C\u6216\u8005\u95EE\u7528\u6237\u3002\uFF09`;
17652
+ const tail = input.toLead === true ? input.ok ? "\uFF08\u8FD9\u662F\u4F60\u95EE\u5B83\u7684\u7ED3\u679C\uFF1A\u63A5\u7740\u505A\u4F60\u624B\u4E0A\u7684\u4E8B\uFF0C\u628A\u5B83\u7528\u5230\u4F60\u7684\u7ED3\u8BBA\u91CC\u3002\uFF09" : "\uFF08\u5B83\u6CA1\u505A\u6210\uFF1A\u63A5\u7740\u505A\u4F60\u624B\u4E0A\u7684\u4E8B\uFF0C\u80FD\u7ED5\u8FC7\u53BB\u5C31\u7ED5\u8FC7\u53BB\uFF0C\u7ED5\u4E0D\u8FC7\u53BB\u5C31\u5728\u4F60\u7684\u7ED3\u8BBA\u91CC\u8BF4\u6E05\u695A\u3002\uFF09" : input.ok ? `\uFF08\u770B\u60C5\u51B5\u544A\u8BC9\u7528\u6237\uFF1A\u6709\u7528\u6237\u8BE5\u77E5\u9053\u6216\u8981\u505A\u7684\uFF0C\u7528\u4E00\u4E24\u53E5\u8BDD\u8BF4\u8981\u70B9\uFF0C\u5B8C\u6574\u8FC7\u7A0B\u5728\u300C${input.agent}\u300D\u7684\u5BF9\u8BDD\u91CC\uFF1B\u6CA1\u6709\u7684\u8BDD\u6574\u6BB5\u56DE\u590D\u53EA\u5199\u300C${QUIET}\u300D\u3002\u8FD8\u8981\u522B\u7684 agent \u63A5\u7740\u505A\u7684\uFF0C\u53EF\u4EE5\u518D\u4EA4\u3002\uFF09` : `\uFF08\u544A\u8BC9\u7528\u6237\u54EA\u91CC\u6CA1\u505A\u6210\u3001\u4E3A\u4EC0\u4E48\uFF1B\u9700\u8981\u7684\u8BDD\u6362\u4E2A\u8BF4\u6CD5\u518D\u4EA4\u4E00\u6B21\uFF0C\u6216\u8005\u95EE\u7528\u6237\u3002\uFF09`;
17653
+ const asked = input.consulted !== void 0 && input.consulted.length > 0 ? `
17654
+
17655
+ \uFF08\u505A\u8FD9\u4EF6\u4E8B\u65F6\u5B83\u8FD8\u95EE\u4E86\uFF1A${input.consulted.join("\u3001")}\u3002\uFF09` : "";
17504
17656
  return `${head}
17505
17657
 
17506
- ${input.reply.trim()}
17658
+ ${input.reply.trim()}${asked}
17507
17659
 
17508
17660
  ${tail}`;
17509
17661
  }
17662
+ function threadsBetween(all, a, b) {
17663
+ return all.filter((h) => {
17664
+ const from = h.chain?.at(-2);
17665
+ const to = h.chain?.at(-1);
17666
+ return from === a && to === b || from === b && to === a;
17667
+ });
17668
+ }
17510
17669
  function parseRelay(text) {
17511
17670
  const [first = "", ...rest] = text.split("\n");
17512
17671
  const head = /^(「([^」]+)」(交回了|没有做完)([^()]{1,20}?)交给它的事:(.*))$/.exec(first);
@@ -17519,16 +17678,22 @@ function parseRelay(text) {
17519
17678
  function oneLine(text) {
17520
17679
  return text.replace(/\s+/g, " ").replace(/[()]/g, (m) => m === "\uFF08" ? "(" : ")").trim();
17521
17680
  }
17681
+ var REMINDER_NOTE = /\n\n(这是你在线索 \S+ 上定的提醒:[^)]*)$/;
17682
+ function threadReminder(prompt, thread, by) {
17683
+ return `${prompt}
17684
+
17685
+ \uFF08\u8FD9\u662F\u4F60\u5728\u7EBF\u7D22 ${thread} \u4E0A\u5B9A\u7684\u63D0\u9192\uFF1A\u8981\u8BA9${by}\u77E5\u9053\u7684\uFF0C\u5230\u70B9\u540E\u7528 agent_message \u53D1\u7ED9\u5B83\uFF0Cthread \u586B ${thread}\uFF0Ckind \u586B update\uFF1B\u4F60\u7684\u666E\u901A\u56DE\u590D\u5B83\u770B\u4E0D\u5230\u3002\uFF09`;
17686
+ }
17522
17687
  function reminderPrompts(text) {
17523
17688
  const single = /^\[SCHEDULE REMINDER\]\n[\s\S]*?^reminder_prompt_json: (.*)$/m.exec(text);
17524
17689
  if (single !== null)
17525
- return [jsonString(single[1])];
17690
+ return [jsonString(single[1]).replace(REMINDER_NOTE, "")];
17526
17691
  const batch = /^\[SCHEDULE REMINDER BATCH\]\n[\s\S]*?^reminders_json: (.*)$/m.exec(text);
17527
17692
  if (batch === null)
17528
17693
  return void 0;
17529
17694
  try {
17530
17695
  const items = JSON.parse(batch[1]);
17531
- return items.map((item) => String(item.reminder_prompt ?? "")).filter((p) => p !== "");
17696
+ return items.map((item) => String(item.reminder_prompt ?? "").replace(REMINDER_NOTE, "")).filter((p) => p !== "");
17532
17697
  } catch {
17533
17698
  return [];
17534
17699
  }
@@ -17765,6 +17930,8 @@ export {
17765
17930
  AgentTaskRun,
17766
17931
  INTERVENE_CAPABILITY,
17767
17932
  GAMES_CAPABILITY,
17933
+ OWN_SOURCE,
17934
+ SCREEN_SOURCE,
17768
17935
  OWN_IMAGE,
17769
17936
  SHOT_IMAGE,
17770
17937
  GamesSettings,
@@ -17780,6 +17947,7 @@ export {
17780
17947
  SKILLHUB_CAPABILITY,
17781
17948
  PERSONA_CAPABILITY,
17782
17949
  Persona,
17950
+ PersonaSettings,
17783
17951
  COMPACTION_CAPABILITY,
17784
17952
  DEFAULT_COMPACTION_THRESHOLD,
17785
17953
  CompactionSettings,
@@ -17796,11 +17964,16 @@ export {
17796
17964
  expandSlash,
17797
17965
  parseGitHubLink,
17798
17966
  BY_YOU,
17967
+ QUIET,
17799
17968
  isQuiet,
17800
17969
  taskMessage,
17801
17970
  parseTask,
17971
+ threadMessage,
17972
+ parseThreadNote,
17802
17973
  relayMessage,
17974
+ threadsBetween,
17803
17975
  parseRelay,
17976
+ threadReminder,
17804
17977
  reminderPrompts,
17805
17978
  reminderLine,
17806
17979
  UPDATE_RULE
@@ -3,7 +3,7 @@ import {
3
3
  ScriptFamily,
4
4
  ScriptId,
5
5
  external_exports
6
- } from "./chunk-HPQCV6WO.js";
6
+ } from "./chunk-IH3K4QPN.js";
7
7
  import {
8
8
  __commonJS,
9
9
  __require,