openmates 0.15.0-alpha.63 → 0.15.0-alpha.65

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.
@@ -2130,10 +2130,6 @@ var CHAT_MODELS = [
2130
2130
  { id: "claude-fable-5", name: "Claude Fable 5" },
2131
2131
  { id: "claude-opus-5", name: "Claude Opus 5" },
2132
2132
  { id: "claude-sonnet-5", name: "Claude Sonnet 5" },
2133
- { id: "claude-opus-4-8", name: "Claude Opus 4.8" },
2134
- { id: "claude-opus-4-7", name: "Claude Opus 4.7" },
2135
- { id: "claude-opus-4-6", name: "Claude Opus 4.6" },
2136
- { id: "claude-sonnet-4-6", name: "Claude Sonnet 4.6" },
2137
2133
  { id: "claude-haiku-4-5-20251001", name: "Claude Haiku 4.5" },
2138
2134
  { id: "gpt-5.4", name: "GPT-5.4" },
2139
2135
  { id: "gpt-oss-120b", name: "GPT-OSS-120b" },
@@ -17912,6 +17908,12 @@ function withAppSkillRunOptions(input, options) {
17912
17908
  }
17913
17909
  };
17914
17910
  }
17911
+ function normalizeOptionalGoal(value) {
17912
+ if (value === void 0) return null;
17913
+ const trimmed = value.trim();
17914
+ if (!trimmed) throw new OpenMatesConfigError("Chat goal must not be empty");
17915
+ return trimmed;
17916
+ }
17915
17917
  var IDEABUCKET_DEFAULT_PROCESSING_PROMPT2 = `These are my captured ideas for today. Please process them, group related thoughts, suggest next actions, and ask clarifying questions where needed:
17916
17918
 
17917
17919
  If an idea requires deeper work, create or suggest sub-chats for focused research, planning, todos, docs, or implementation.`;
@@ -18909,7 +18911,11 @@ var OpenMatesChats = class {
18909
18911
  async send(message, options = {}) {
18910
18912
  const history = normalizeHistory(options.history);
18911
18913
  const finalMessage = hasRememberMessageReference(message) ? rewriteRememberMessageReferences(message, rememberableMessagesFromRecords(history)) : message;
18912
- if (options.saveToAccount === true) {
18914
+ const goal = normalizeOptionalGoal(options.goal);
18915
+ if (goal && options.saveToAccount === false) {
18916
+ throw new OpenMatesConfigError("Chat goals require a saved account chat. Omit saveToAccount or set saveToAccount: true.");
18917
+ }
18918
+ if (options.saveToAccount === true || goal) {
18913
18919
  return this.sendSaved(finalMessage, options);
18914
18920
  }
18915
18921
  const result = await this.client.request("/v1/sdk/chats", {
@@ -19055,6 +19061,13 @@ var OpenMatesChats = class {
19055
19061
  if (terminal.state !== "TERMINAL") {
19056
19062
  throw new OpenMatesConfigError("Saved chat recovery did not reach terminal persistence");
19057
19063
  }
19064
+ const goal = normalizeOptionalGoal(options.goal);
19065
+ const plan = goal ? await this.createAttachedGoalPlan({
19066
+ chatId,
19067
+ chatKey,
19068
+ goal,
19069
+ title: normalizeOptionalGoal(options.goalTitle) ?? options.title ?? goal
19070
+ }) : null;
19058
19071
  return {
19059
19072
  content: recovered.content,
19060
19073
  category: recovered.category,
@@ -19062,9 +19075,23 @@ var OpenMatesChats = class {
19062
19075
  chat_id: result.chat_id ?? chatId,
19063
19076
  task_id: result.task_id,
19064
19077
  preflight: result.preflight,
19065
- terminal
19078
+ terminal,
19079
+ ...plan ? { plan } : {}
19066
19080
  };
19067
19081
  }
19082
+ async createAttachedGoalPlan(input) {
19083
+ const masterKey = await this.client.masterKey();
19084
+ const payload = await buildCreateUserPlanInput(masterKey, {
19085
+ title: input.title,
19086
+ goal: input.goal,
19087
+ primaryChatId: input.chatId,
19088
+ primaryChatKey: input.chatKey,
19089
+ status: "draft"
19090
+ });
19091
+ const response = await this.client.request("/v1/user-plans", payload);
19092
+ if (!response.plan) throw new OpenMatesApiError(500, { detail: "User plan response missing plan" });
19093
+ return toPublicPlan(await decryptUserPlan(response.plan, masterKey));
19094
+ }
19068
19095
  async pollRecoveryClaim(taskId, timeoutMs, pollIntervalMs) {
19069
19096
  if (!Number.isFinite(timeoutMs) || !Number.isFinite(pollIntervalMs) || timeoutMs <= 0 || pollIntervalMs <= 0) {
19070
19097
  throw new OpenMatesConfigError("Recovery timeout and poll interval must be finite and positive");
@@ -65451,7 +65478,7 @@ async function main() {
65451
65478
  }
65452
65479
  if (parsed.flags.help === true && !subcommand) {
65453
65480
  if (command === "chat") {
65454
- printPlansHelp();
65481
+ printGoalChatHelp();
65455
65482
  return;
65456
65483
  }
65457
65484
  if (command === "chats") {
@@ -65617,7 +65644,7 @@ async function main() {
65617
65644
  return;
65618
65645
  }
65619
65646
  if (command === "chat" && parsed.flags.goal) {
65620
- await handlePlans(client, "create", [], parsed.flags, redactor);
65647
+ await handleGoalChat(client, parsed.flags, redactor);
65621
65648
  return;
65622
65649
  }
65623
65650
  if (command === "tasks") {
@@ -67005,6 +67032,68 @@ function printPlanOutput(plan, flags) {
67005
67032
  printHistoryCommands(plan.encrypted.history ?? null);
67006
67033
  }
67007
67034
  }
67035
+ function normalizeGoalFlag(value) {
67036
+ if (typeof value !== "string" || !value.trim()) {
67037
+ throw new Error("Missing goal. Usage: openmates chat --goal <goal>");
67038
+ }
67039
+ return value.trim();
67040
+ }
67041
+ async function handleGoalChat(client, flags, redactor) {
67042
+ if (resolveApiKey(flags)) {
67043
+ throw new Error("openmates chat --goal uses your paired CLI session. For API-key clients, use the npm or pip SDK chats.send(..., { goal }).");
67044
+ }
67045
+ if (!client.hasSession()) {
67046
+ throw new Error("openmates chat --goal requires login. Run 'openmates login' first.");
67047
+ }
67048
+ const goal = normalizeGoalFlag(flags.goal);
67049
+ const result = await sendMessageStreaming(
67050
+ client,
67051
+ {
67052
+ message: typeof flags.message === "string" && flags.message.trim() ? flags.message.trim() : goal,
67053
+ chatId: void 0,
67054
+ incognito: false,
67055
+ json: flags.json === true,
67056
+ autoApproveSubChats: flags["auto-approve"] === true,
67057
+ autoApproveMemories: flags["auto-approve-memories"] === true,
67058
+ acceptTaskProposals: flags["accept-task-proposals"] === true,
67059
+ piiDetection: flags["no-pii-detection"] !== true,
67060
+ responseTimeoutMs: parseResponseTimeoutMs(flags),
67061
+ ...teamContextFromFlags(flags)
67062
+ },
67063
+ redactor
67064
+ );
67065
+ if (!("chatId" in result) || !result.chatId) {
67066
+ throw new Error("Goal chat did not return a saved chat id.");
67067
+ }
67068
+ const masterKey = client.getMasterKeyBytes();
67069
+ const linkContext = await resolvePlanLinkKeyContext(client, masterKey, flags, {
67070
+ primaryChatId: result.chatId,
67071
+ linkedProjectIds: splitCsvFlag(flags.project ?? flags.projects)
67072
+ });
67073
+ const planInput = await buildCreateUserPlanInput(masterKey, {
67074
+ title: typeof flags.title === "string" && flags.title.trim() ? flags.title.trim() : goal,
67075
+ summary: typeof flags.summary === "string" ? flags.summary : "",
67076
+ goal,
67077
+ status: normalizePlanStatus(typeof flags.status === "string" ? flags.status : void 0),
67078
+ primaryChatId: linkContext.primaryChatId,
67079
+ primaryChatKey: linkContext.primaryChatKey,
67080
+ linkedProjectIds: linkContext.linkedProjectIds,
67081
+ linkedProjectKeys: linkContext.linkedProjectKeys
67082
+ });
67083
+ const plan = await decryptUserPlan(await client.createUserPlan(planInput), masterKey);
67084
+ if (flags.json === true) {
67085
+ printJson2({ ...result, chat_id: result.chatId, plan: planToJson(plan) });
67086
+ return;
67087
+ }
67088
+ const shortChatId = result.chatId.slice(0, 8);
67089
+ process.stdout.write(
67090
+ `${SEP}
67091
+ \x1B[2mPlan attached: ${plan.shortId} (${plan.status.replaceAll("_", " ")})\x1B[0m
67092
+ \x1B[2mPlan: openmates plans show ${plan.shortId}\x1B[0m
67093
+ \x1B[2mContinue: openmates chats send --chat ${shortChatId} "your message"\x1B[0m
67094
+ `
67095
+ );
67096
+ }
67008
67097
  async function handleProjects(client, subcommand, rest, flags, redactor) {
67009
67098
  if (!subcommand || subcommand === "help" || flags.help === true) {
67010
67099
  printProjectsHelp();
@@ -74276,6 +74365,7 @@ Commands:
74276
74365
  openmates signup Create an account from the terminal
74277
74366
  openmates logout Log out and clear session
74278
74367
  openmates whoami [--json] Show account info
74368
+ openmates chat --goal <goal> Start a saved chat with an attached draft plan
74279
74369
  openmates chats [--help] Chat commands (list, search, show, ...)
74280
74370
  openmates tasks [--help] Task commands (list, create, board, ...)
74281
74371
  openmates plans [--help] Plan commands (list, create, approve, checks, ...)
@@ -74720,6 +74810,25 @@ Notes:
74720
74810
  pause currently moves a plan back to awaiting_confirmation; resume sets it active.
74721
74811
  Normal output decrypts plan fields locally; use --json for machine-readable plaintext fields.`);
74722
74812
  }
74813
+ function printGoalChatHelp() {
74814
+ console.log(`Goal chat command:
74815
+ openmates chat --goal <goal> [--title <title>] [--project <id>] [--json]
74816
+
74817
+ Starts a new saved chat and attaches a minimal encrypted draft Plan to it.
74818
+ Use this for lightweight agentic work that should keep a durable goal, checks,
74819
+ and continuation state available from the chat.
74820
+
74821
+ Options:
74822
+ --goal <goal> Required durable goal for the attached Plan
74823
+ --title <title> Optional Plan title (defaults to the goal)
74824
+ --summary <text> Optional Plan summary
74825
+ --project <id> Also link the Plan to a Project
74826
+ --json Output chat and Plan details as JSON
74827
+
74828
+ Examples:
74829
+ openmates chat --goal "Improve the onboarding email and verify it reads clearly"
74830
+ openmates chat --goal "Ship the docs update" --title "Docs launch" --json`);
74831
+ }
74723
74832
  function printProjectsHelp() {
74724
74833
  console.log(`Projects commands:
74725
74834
  openmates projects ask <name> [--description <text>] [--json]
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  getExtForLang,
4
4
  serializeToYaml
5
- } from "./chunk-BAH272XW.js";
5
+ } from "./chunk-XBSHGFYK.js";
6
6
  import "./chunk-MLWBMJEN.js";
7
7
  export {
8
8
  getExtForLang,
package/dist/index.d.ts CHANGED
@@ -5950,6 +5950,8 @@ interface ChatCreateOptions {
5950
5950
  focusMode?: FocusModeSelection;
5951
5951
  chatId?: string;
5952
5952
  title?: string;
5953
+ goal?: string;
5954
+ goalTitle?: string;
5953
5955
  }
5954
5956
  interface ChatSendOptions extends ChatCreateOptions {
5955
5957
  history?: Array<Record<string, unknown>> | {
@@ -6367,6 +6369,7 @@ declare class OpenMatesChats {
6367
6369
  retry(options: ChatRetryOptions): Promise<Record<string, unknown>>;
6368
6370
  send(message: string, options?: ChatSendOptions): Promise<ChatResponse>;
6369
6371
  private sendSaved;
6372
+ private createAttachedGoalPlan;
6370
6373
  private pollRecoveryClaim;
6371
6374
  private openRecoveryClaim;
6372
6375
  export(chatId: string, options?: {
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ import {
36
36
  renderPlanList,
37
37
  renderSupportInfo,
38
38
  serializeToYaml
39
- } from "./chunk-BAH272XW.js";
39
+ } from "./chunk-XBSHGFYK.js";
40
40
  import "./chunk-MLWBMJEN.js";
41
41
  export {
42
42
  APP_SKILL_METADATA,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openmates",
3
- "version": "0.15.0-alpha.63",
3
+ "version": "0.15.0-alpha.65",
4
4
  "description": "OpenMates CLI and SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",