@things-factory/ai-assistant 10.1.281 → 10.1.283

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.
@@ -336,6 +336,9 @@ export declare class OxAssistantChat extends LitElement {
336
336
  private inviting;
337
337
  /** Who is typing now, by name - kept by `typingRoom`, redrawn on each notice and as they fade. */
338
338
  private typingNames;
339
+ /** What the tool working on this turn last said it is doing; empty when nothing is said. */
340
+ private progressText;
341
+ private _progressSub?;
339
342
  private typingRoom;
340
343
  private _typingSub?;
341
344
  private _typingTimer?;
@@ -419,6 +422,8 @@ export declare class OxAssistantChat extends LitElement {
419
422
  private _startPresence;
420
423
  private _stopPresence;
421
424
  private _startMessageSubscription;
425
+ private _startProgress;
426
+ private _stopProgress;
422
427
  /** The room's "typing" line - notices of the others, which fade by themselves (`TypingRoom`). */
423
428
  private _startTypingSubscription;
424
429
  private _refreshTyping;
@@ -286,6 +286,14 @@ const CHAT_TYPING_SUBSCRIPTION = gql `
286
286
  }
287
287
  }
288
288
  `;
289
+ /* What a long tool call of this turn is doing now - "Building piece 3 of 7" - beside the waiting dots. */
290
+ const ASSISTANT_PROGRESS_SUBSCRIPTION = gql `
291
+ subscription AssistantProgress($key: String!) {
292
+ assistantProgress(key: $key) {
293
+ text
294
+ }
295
+ }
296
+ `;
289
297
  /* The selection a screen request carries, noted before the request (design/ai/shared-dock.md §2-11-1). */
290
298
  const APPEND_SESSION_NOTE_MUTATION = gql `
291
299
  mutation AppendSessionNote($sessionId: String!, $content: String!) {
@@ -363,6 +371,8 @@ let OxAssistantChat = class OxAssistantChat extends LitElement {
363
371
  this.inviting = false;
364
372
  /** Who is typing now, by name - kept by `typingRoom`, redrawn on each notice and as they fade. */
365
373
  this.typingNames = [];
374
+ /** What the tool working on this turn last said it is doing; empty when nothing is said. */
375
+ this.progressText = '';
366
376
  this.typingRoom = new TypingRoom();
367
377
  /** roster online 재평가 트리거 — heartbeat tick 마다 갱신(시간 경과 반영). */
368
378
  this._presenceTick = 0;
@@ -1496,6 +1506,11 @@ let OxAssistantChat = class OxAssistantChat extends LitElement {
1496
1506
  .msg.pending {
1497
1507
  opacity: 0.5;
1498
1508
  }
1509
+ .progress-text {
1510
+ margin-left: 8px;
1511
+ font-size: 0.85em;
1512
+ color: var(--md-sys-color-on-surface-variant);
1513
+ }
1499
1514
  .typing-dots {
1500
1515
  display: inline-flex;
1501
1516
  gap: 4px;
@@ -2848,6 +2863,28 @@ let OxAssistantChat = class OxAssistantChat extends LitElement {
2848
2863
  /* 구독 미지원 환경 — 조용히 스킵 */
2849
2864
  }
2850
2865
  }
2866
+ _startProgress(key) {
2867
+ this._stopProgress();
2868
+ try {
2869
+ this._progressSub = client.subscribe({ query: ASSISTANT_PROGRESS_SUBSCRIPTION, variables: { key } }).subscribe({
2870
+ next: ({ data }) => {
2871
+ if (typeof data?.assistantProgress?.text === 'string')
2872
+ this.progressText = data.assistantProgress.text;
2873
+ },
2874
+ error: () => {
2875
+ /* no progress line - the turn itself is unaffected */
2876
+ }
2877
+ });
2878
+ }
2879
+ catch {
2880
+ /* subscriptions unavailable */
2881
+ }
2882
+ }
2883
+ _stopProgress() {
2884
+ this._progressSub?.unsubscribe();
2885
+ this._progressSub = undefined;
2886
+ this.progressText = '';
2887
+ }
2851
2888
  /** The room's "typing" line - notices of the others, which fade by themselves (`TypingRoom`). */
2852
2889
  _startTypingSubscription() {
2853
2890
  try {
@@ -3032,7 +3069,9 @@ let OxAssistantChat = class OxAssistantChat extends LitElement {
3032
3069
  ? 'open'
3033
3070
  : ''} ${line.redacted ? 'redacted' : ''}">
3034
3071
  ${line.pending
3035
- ? html `<span class="typing-dots"><span></span><span></span><span></span></span>`
3072
+ ? html `<span class="typing-dots"><span></span><span></span><span></span></span>${this.progressText
3073
+ ? html `<span class="progress-text" role="status" aria-live="polite">${this.progressText}</span>`
3074
+ : nothing}`
3036
3075
  : line.redacted
3037
3076
  ? html `<div class="redacted-body"><md-icon>lock</md-icon><span>${content}</span></div>`
3038
3077
  : isMarkdown
@@ -4932,6 +4971,10 @@ let OxAssistantChat = class OxAssistantChat extends LitElement {
4932
4971
  this.errorMessage = undefined;
4933
4972
  // 가짜 pending 응답 표시 (UX 부드럽게)
4934
4973
  this.lines = [...this.lines, { role: 'assistant', content: '', pending: true, _localId: asstLocalId }];
4974
+ /* A key for this turn only: a long tool call tells its progress under it (assistantProgress). */
4975
+ const progressKey = `p${Date.now().toString(36)}${Math.random().toString(36).slice(2, 10)}`;
4976
+ requestContext.hostContext = { ...(requestContext.hostContext ?? {}), progressKey };
4977
+ this._startProgress(progressKey);
4935
4978
  try {
4936
4979
  if (attachmentsToSend.length > 0 && !attachmentIds) {
4937
4980
  requestContext.hostContext = {
@@ -5078,6 +5121,7 @@ let OxAssistantChat = class OxAssistantChat extends LitElement {
5078
5121
  this.lastFailedInput = text;
5079
5122
  }
5080
5123
  finally {
5124
+ this._stopProgress();
5081
5125
  this.busy = false;
5082
5126
  }
5083
5127
  }
@@ -5298,6 +5342,10 @@ __decorate([
5298
5342
  state(),
5299
5343
  __metadata("design:type", Array)
5300
5344
  ], OxAssistantChat.prototype, "typingNames", void 0);
5345
+ __decorate([
5346
+ state(),
5347
+ __metadata("design:type", Object)
5348
+ ], OxAssistantChat.prototype, "progressText", void 0);
5301
5349
  __decorate([
5302
5350
  state(),
5303
5351
  __metadata("design:type", Object)
@@ -19,6 +19,8 @@ export declare class AiAgentSettingLet extends AiAgentSettingLet_base {
19
19
  private keyDraft;
20
20
  private agents;
21
21
  private modelList;
22
+ private offered;
23
+ private get providers();
22
24
  private saver;
23
25
  private get settings();
24
26
  private get loadFailed();
@@ -64,7 +64,15 @@ const SAVE_MUTATION = gql `
64
64
  saveAiAgents(input: $input)
65
65
  }
66
66
  `;
67
+ const PROVIDERS_QUERY = gql `
68
+ query AiAgentProviders {
69
+ aiAgentProviders
70
+ }
71
+ `;
72
+ /* What the server offers; claude-code only on a development server with the Claude Code CLI logged in. */
67
73
  const PROVIDERS = ['openai', 'anthropic', 'gemini'];
74
+ /** A provider that answers on what the server's machine is logged in to: no key. */
75
+ const keyless = (provider) => provider === 'claude-code';
68
76
  /**
69
77
  * A domain's AI agents - the card in Settings › {domain} settings (design/ai/agent-settings.md §7-1, §7-2).
70
78
  *
@@ -79,6 +87,7 @@ let AiAgentSettingLet = class AiAgentSettingLet extends localize(i18next)(LitEle
79
87
  /* The agents of this domain and the domains above (ADR-0190). */
80
88
  this.agents = new QueryController(this, SETTINGS_QUERY, { fetchPolicy: 'network-only' });
81
89
  this.modelList = new QueryController(this, MODELS_QUERY, { variables: () => this.modelsAsk, fetchPolicy: 'network-only' });
90
+ this.offered = new QueryController(this, PROVIDERS_QUERY, { fetchPolicy: 'network-only' });
82
91
  /* A refusal is drawn beside the editor or in a prompt here, so the link does not report it again. */
83
92
  this.saver = new MutationController(this, SAVE_MUTATION, { refetch: () => [this.agents], showsError: true });
84
93
  }
@@ -264,6 +273,9 @@ let AiAgentSettingLet = class AiAgentSettingLet extends localize(i18next)(LitEle
264
273
  }
265
274
  `
266
275
  ]; }
276
+ get providers() {
277
+ return this.offered.data?.aiAgentProviders ?? PROVIDERS;
278
+ }
267
279
  get settings() {
268
280
  return this.agents.data?.aiAgentSettings;
269
281
  }
@@ -375,6 +387,8 @@ let AiAgentSettingLet = class AiAgentSettingLet extends localize(i18next)(LitEle
375
387
  `;
376
388
  }
377
389
  renderKey(agent) {
390
+ if (keyless(agent.provider))
391
+ return html `<span class="key">${t('key-none-needed', 'No key - this computer\'s login')}</span>`;
378
392
  switch (agent.keyState) {
379
393
  case 'own':
380
394
  return html `<span class="key">${agent.keyHint}</span>`;
@@ -440,7 +454,7 @@ let AiAgentSettingLet = class AiAgentSettingLet extends localize(i18next)(LitEle
440
454
  const draft = this.draft;
441
455
  const stored = this.settings.agents.find(one => one.id === draft.id);
442
456
  const hasStoredKey = !!stored && stored.keyState === 'own' && draft.provider === stored.provider;
443
- const modelLocked = !draft.apiKey.trim() && !hasStoredKey;
457
+ const modelLocked = !keyless(draft.provider) && !draft.apiKey.trim() && !hasStoredKey;
444
458
  const offered = this.models.state === 'ready' ? this.models.models : [];
445
459
  const modelGone = this.models.state === 'ready' && !!draft.model && !offered.includes(draft.model);
446
460
  const canSave = !!draft.name.trim() && !!draft.model && !modelLocked && !modelGone && this.models.state === 'ready' && !this.saving;
@@ -453,10 +467,15 @@ let AiAgentSettingLet = class AiAgentSettingLet extends localize(i18next)(LitEle
453
467
  <label>
454
468
  ${t('provider', 'Provider')}
455
469
  <select @change=${(e) => this.onProvider(e.target.value)}>
456
- ${PROVIDERS.map(one => html `<option value=${one} ?selected=${one === draft.provider}>${providerLabel(one)}</option>`)}
470
+ ${[...new Set([...this.providers, draft.provider].filter(Boolean))].map(one => html `<option value=${one} ?selected=${one === draft.provider}>${providerLabel(one)}</option>`)}
457
471
  </select>
458
472
  </label>
459
- <label>
473
+ ${keyless(draft.provider)
474
+ ? html `<label>
475
+ ${t('api-key', 'API key')}
476
+ <span class="hint">${t('key-none-needed-hint', 'None: it answers on the Claude Code CLI logged in on the computer this server runs on. For development only.')}</span>
477
+ </label>`
478
+ : html `<label>
460
479
  ${t('api-key', 'API key')}
461
480
  <input
462
481
  type="password"
@@ -465,7 +484,7 @@ let AiAgentSettingLet = class AiAgentSettingLet extends localize(i18next)(LitEle
465
484
  .value=${draft.apiKey}
466
485
  @input=${(e) => this.patch({ apiKey: e.target.value })}
467
486
  @change=${() => this.loadModels()} />
468
- </label>
487
+ </label>`}
469
488
  <label>
470
489
  ${t('model', 'Model')}
471
490
  <span class="with-action">
@@ -540,13 +559,13 @@ let AiAgentSettingLet = class AiAgentSettingLet extends localize(i18next)(LitEle
540
559
  return;
541
560
  const stored = this.settings?.agents.find(one => one.id === draft.id && !one.inherited);
542
561
  const useStored = !draft.apiKey.trim() && stored?.keyState === 'own' && stored.provider === draft.provider;
543
- if (!draft.apiKey.trim() && !useStored) {
562
+ if (!keyless(draft.provider) && !draft.apiKey.trim() && !useStored) {
544
563
  this.modelsAsk = undefined;
545
564
  return;
546
565
  }
547
566
  const ask = {
548
567
  provider: draft.provider,
549
- ...(draft.apiKey.trim() ? { apiKey: draft.apiKey.trim() } : { agentId: draft.id }),
568
+ ...(keyless(draft.provider) ? {} : draft.apiKey.trim() ? { apiKey: draft.apiKey.trim() } : { agentId: draft.id }),
550
569
  ...(draft.baseURL.trim() && { baseURL: draft.baseURL.trim() }),
551
570
  ...(draft.organization.trim() && { organization: draft.organization.trim() })
552
571
  };
@@ -27,7 +27,7 @@ export function rememberAgent(contextPath, agentId) {
27
27
  /* A browser that blocks storage still picks - it just asks again next time. */
28
28
  }
29
29
  }
30
- const PROVIDER_LABEL = { openai: 'OpenAI', anthropic: 'Claude', gemini: 'Gemini' };
30
+ const PROVIDER_LABEL = { openai: 'OpenAI', anthropic: 'Claude', gemini: 'Gemini', 'claude-code': 'Claude Code (this computer)' };
31
31
  /** `Claude · claude-sonnet-4-6` - what the picker shows beside a name. */
32
32
  export function agentDetail(choice) {
33
33
  return `${PROVIDER_LABEL[choice.provider] ?? choice.provider} · ${choice.model}`;
@@ -116,6 +116,7 @@ declare class AiModelPriceInput {
116
116
  export declare class AiAgentResolver {
117
117
  aiAgentSettings(context: ResolverContext): Promise<AiAgentSettings>;
118
118
  aiAgentChoices(context: ResolverContext): Promise<AiAgentChoice[]>;
119
+ aiAgentProviders(): Promise<string[]>;
119
120
  aiProviderModels(provider: string, apiKey: string, agentId: string, baseURL: string, organization: string, context: ResolverContext): Promise<string[]>;
120
121
  saveAiAgents(input: AiAgentsInput, context: ResolverContext): Promise<boolean>;
121
122
  aiUsageOverview(from: Date, to: Date, bucket: string, context: ResolverContext): Promise<AiUsageOverview>;
@@ -37,7 +37,7 @@ tslib_1.__decorate([
37
37
  tslib_1.__metadata("design:type", String)
38
38
  ], AiAgentView.prototype, "name", void 0);
39
39
  tslib_1.__decorate([
40
- (0, type_graphql_1.Field)({ description: 'openai, anthropic or gemini.' }),
40
+ (0, type_graphql_1.Field)({ description: 'openai, anthropic, gemini, or claude-code (a development server only).' }),
41
41
  tslib_1.__metadata("design:type", String)
42
42
  ], AiAgentView.prototype, "provider", void 0);
43
43
  tslib_1.__decorate([
@@ -456,6 +456,9 @@ let AiAgentResolver = class AiAgentResolver {
456
456
  isDefault: one.spec.id === directory.defaultAgentId
457
457
  }));
458
458
  }
459
+ async aiAgentProviders() {
460
+ return (0, ai_client_base_1.aiProvidersOffered)();
461
+ }
459
462
  async aiProviderModels(provider, apiKey, agentId, baseURL, organization, context) {
460
463
  let key = apiKey?.trim();
461
464
  if (!key && agentId) {
@@ -541,6 +544,15 @@ tslib_1.__decorate([
541
544
  tslib_1.__metadata("design:paramtypes", [Object]),
542
545
  tslib_1.__metadata("design:returntype", Promise)
543
546
  ], AiAgentResolver.prototype, "aiAgentChoices", null);
547
+ tslib_1.__decorate([
548
+ (0, type_graphql_1.Query)(() => [String], {
549
+ description: 'The providers this server offers an agent: openai, anthropic, gemini, and claude-code where the server is a development one with the Claude Code CLI logged in (it needs no key).'
550
+ }),
551
+ (0, type_graphql_1.Directive)('@privilege(category: "setting", privilege: "query", domainOwnerGranted: true)'),
552
+ tslib_1.__metadata("design:type", Function),
553
+ tslib_1.__metadata("design:paramtypes", []),
554
+ tslib_1.__metadata("design:returntype", Promise)
555
+ ], AiAgentResolver.prototype, "aiAgentProviders", null);
544
556
  tslib_1.__decorate([
545
557
  (0, type_graphql_1.Query)(() => [String], {
546
558
  description: 'The conversation models a provider offers to a key - a typed key, or the stored key of one of this domain\'s agents. A model is only ever picked from this list.'