@almyty/chat 1.5.9 → 1.5.11

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/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { render, Box, Text } from 'ink';
4
- import { AlmytyClient, resolveCredentials, getOrgSlugFromToken } from '@almyty/client';
4
+ import { AlmytyClient, resolveCredentials, defaultOrganization } from '@almyty/client';
5
5
  import { AgentSelector } from './components.js';
6
6
  import { ChatApp, exitMessage } from './app.js';
7
7
  import { helpText, isNonInteractive, parseArgs, resolveRef, splitRef, useColor } from './args.js';
@@ -48,7 +48,9 @@ async function main() {
48
48
  stdoutTty: process.stdout.isTTY === true,
49
49
  });
50
50
  const ref = resolveRef(args);
51
- const defaultOrg = getOrgSlugFromToken(creds.token);
51
+ // `almyty login` stores an API key plus the organization it chose; an
52
+ // API key is no JWT, so the organization comes from the stored id.
53
+ const defaultOrg = defaultOrganization(creds);
52
54
  let orgSlug;
53
55
  let agentSlug;
54
56
  if (ref) {
package/dist/stream.js CHANGED
@@ -122,7 +122,7 @@ export function reduceStreamEvent(prev, event) {
122
122
  return s;
123
123
  }
124
124
  case 'verify.failed':
125
- s.emit.push({ role: 'info', text: 'verification rejected the draft — revising' });
125
+ s.emit.push({ role: 'info', text: 'the check found errors in the draft — revising' });
126
126
  s.label = 'Revising';
127
127
  return s;
128
128
  // ── Workflow pipelines ───────────────────────────────────────
@@ -153,8 +153,12 @@ export function reduceStreamEvent(prev, event) {
153
153
  // pipeline's final output arrives on execution.completed.
154
154
  return s;
155
155
  case 'execution.completed': {
156
- s.usage.cost += num(d.totalCost);
157
- s.usage.tokens += num(d.totalTokens);
156
+ // The pipeline's totals are the sum of the node.completed figures
157
+ // already counted above, not more on top of them: adding them
158
+ // reported every workflow answer at twice its tokens and cost. They
159
+ // stand in only where node events were missed.
160
+ s.usage.cost = Math.max(s.usage.cost, num(d.totalCost));
161
+ s.usage.tokens = Math.max(s.usage.tokens, num(d.totalTokens));
158
162
  const output = formatOutput(d.output);
159
163
  if (output)
160
164
  s.output = output;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almyty/chat",
3
- "version": "1.5.9",
3
+ "version": "1.5.11",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -31,7 +31,7 @@
31
31
  "author": "almyty",
32
32
  "license": "Apache-2.0",
33
33
  "dependencies": {
34
- "@almyty/client": "^1.5.9",
34
+ "@almyty/client": "^1.5.11",
35
35
  "ink": "^8.0.0",
36
36
  "ink-spinner": "^5.0.0",
37
37
  "ink-text-input": "^6.0.0",