ticlawk 0.1.15 → 0.1.16-dev.2

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/bin/ticlawk.mjs CHANGED
@@ -3,8 +3,6 @@
3
3
  import { request } from 'node:http';
4
4
  import { installProcessDiagnostics } from '../src/core/diagnostics.mjs';
5
5
  import {
6
- AF_ADAPTER_KEY,
7
- getConfiguredAdapter,
8
6
  loadPersistentConfig,
9
7
  getStreamingConfigView,
10
8
  normalizeAdapterConfigTarget,
@@ -20,7 +18,7 @@ import {
20
18
  getActiveProfile,
21
19
  listProfiles,
22
20
  } from '../src/core/profiles.mjs';
23
- import { getAdapterAuthHelp, runAdapterAuth } from '../src/core/adapter-registry.mjs';
21
+ import { runAdapterAuth } from '../src/core/adapter-registry.mjs';
24
22
  import { runTiclawkConnect } from '../src/core/ticlawk-control.mjs';
25
23
  import {
26
24
  RUNTIME_DEFINITIONS,
@@ -30,12 +28,40 @@ import { runSelfUpdate, readPkgVersion } from '../src/core/update.mjs';
30
28
  import { getUninstallHelp, runSelfUninstall } from '../src/core/uninstall.mjs';
31
29
  import { getInstallDaemonHelp, runInstallDaemon } from '../src/core/daemon-install.mjs';
32
30
  import { runSetupReadiness } from '../src/core/setup-readiness.mjs';
31
+ import {
32
+ AGENT_COMMAND_HELP,
33
+ runAttachmentUploadCommand,
34
+ runAttachmentViewCommand,
35
+ runGroupCreateCommand,
36
+ runGroupMembersAddCommand,
37
+ runGroupMembersCommand,
38
+ runGroupMembersRemoveCommand,
39
+ runMessageCheckCommand,
40
+ runMessageReactCommand,
41
+ runMessageReadCommand,
42
+ runMessageSearchCommand,
43
+ runMessageSendCommand,
44
+ runProfileShowCommand,
45
+ runProfileUpdateCommand,
46
+ runReminderCancelCommand,
47
+ runReminderListCommand,
48
+ runReminderLogCommand,
49
+ runReminderScheduleCommand,
50
+ runReminderSnoozeCommand,
51
+ runReminderUpdateCommand,
52
+ runServerInfoCommand,
53
+ runTaskClaimCommand,
54
+ runTaskCreateCommand,
55
+ runTaskListCommand,
56
+ runTaskUnclaimCommand,
57
+ runTaskUpdateCommand,
58
+ } from '../src/cli/agent-commands.mjs';
33
59
 
34
60
  const TICLAWK_PORT = Number(process.env.FEED_RELAY_PORT || 8741);
35
61
 
36
62
  function getConfigKeyUsage() {
37
63
  const runtimeKeys = getRuntimeExecutableDefinitions().map((runtime) => runtime.executableCliKey);
38
- return ['adapter', 'streaming...', ...runtimeKeys, 'telegram.bot-token', 'ticlawk.connector-api-key', 'ticlawk.api-url', 'ticlawk.connector-ws-url'].join('|');
64
+ return ['streaming...', ...runtimeKeys, 'ticlawk.connector-api-key', 'ticlawk.api-url', 'ticlawk.connector-ws-url'].join('|');
39
65
  }
40
66
 
41
67
  function getRuntimeConfigExamples() {
@@ -56,7 +82,7 @@ Usage:
56
82
  ticlawk config
57
83
  ticlawk config get <${configKeys}>
58
84
  ticlawk config set <${configKeys}> <value>
59
- ticlawk auth <adapter> [adapter-auth-args...]
85
+ ticlawk auth --code <6-digit-code> [--api-url <url>]
60
86
  ticlawk connect
61
87
  ticlawk profile list
62
88
  ticlawk profile current
@@ -66,44 +92,50 @@ Usage:
66
92
  ticlawk uninstall [-y]
67
93
  ticlawk version
68
94
 
95
+ Agent CLI (run inside an agent runtime; requires TICLAWK_RUNTIME_AGENT_ID):
96
+ ticlawk message send --target <t> # body on stdin
97
+ ticlawk message read --target <t> [opts]
98
+ ticlawk task claim --message-id <id>
99
+ ticlawk task update --task-id <id> --status <s>
100
+ ticlawk task list [--target <t>]
101
+ ticlawk group members --target <t>
102
+ ticlawk server info [--refresh]
103
+
69
104
  Commands:
70
- auth store adapter-specific auth/setup input locally
71
- connect connect the selected adapter to a local runtime
105
+ auth store the ticlawk app pairing code locally
106
+ connect connect ticlawk to a local runtime
72
107
  profile list or switch saved local identities
108
+ message send/read chat messages (agent CLI surface)
109
+ task claim/update/list tasks (agent CLI surface)
110
+ group list members of a group conversation (agent CLI surface)
111
+ server server-info introspection (agent CLI surface)
73
112
  install-daemon install or refresh the background daemon
74
113
  update update the npm package and refresh the daemon
75
114
  uninstall remove service and managed install files, preserving ~/.ticlawk
76
115
 
77
116
  Config examples:
78
- ticlawk config get adapter
79
- ticlawk config set adapter telegram
80
- ticlawk config set adapter ticlawk
81
117
  ticlawk config set streaming off # turn streaming off for all runtimes
82
118
  ticlawk config set streaming.codex default # clear the codex-specific override and inherit the global streaming setting
83
119
  ${getRuntimeConfigExamples()}
84
- ticlawk config set telegram.bot-token <bot-token> # advanced/manual
85
120
  ticlawk config set ticlawk.connector-api-key <key> # advanced/manual
86
121
  ticlawk config set ticlawk.api-url <api-url> # advanced/manual
87
122
  ticlawk config set ticlawk.connector-ws-url <url> # advanced/manual
88
123
 
89
124
  Examples:
90
125
  ticlawk connect
91
- ticlawk auth telegram --bot-token <bot-token>
126
+ ticlawk auth --code <6-digit-code>
92
127
  `;
93
128
  }
94
129
 
95
130
  function getAuthHelp() {
96
- return `ticlawk auth
131
+ return `ticlawk auth --code <6-digit-code> [--api-url <url>]
97
132
 
98
- Use \`auth\` to store adapter-specific auth/setup input locally.
99
- Adapter-specific args live after \`--\` so new adapters can define their own flags
100
- without changing the top-level CLI.
101
-
102
- Examples:
103
- ticlawk auth telegram --bot-token <bot-token>
133
+ Store the ticlawk app pairing code locally. The daemon picks it up on the
134
+ next start and exchanges it for an API key.
104
135
 
105
- Per-adapter help:
106
- ticlawk auth telegram --help
136
+ Options:
137
+ --code <code> 6-digit setup code from the ticlawk app
138
+ --api-url <url> optional ticlawk API base URL override
107
139
  `;
108
140
  }
109
141
 
@@ -132,11 +164,6 @@ function printHelp(helpPath, args = {}) {
132
164
  return;
133
165
  }
134
166
  if (head === 'auth') {
135
- const adapterValue = helpPath[1] || args._?.[1];
136
- if (adapterValue) {
137
- console.log(getAdapterAuthHelp(requireAdapter(adapterValue)));
138
- return;
139
- }
140
167
  console.log(getAuthHelp());
141
168
  return;
142
169
  }
@@ -169,7 +196,6 @@ function parseConfigBoolean(value) {
169
196
  }
170
197
 
171
198
  function printConfigView(config = loadPersistentConfig()) {
172
- console.log(`adapter=${getConfiguredAdapter(config)}`);
173
199
  const view = getStreamingConfigView(config);
174
200
  console.log(`streaming=${formatStreamingValue(view.streaming.value, view.streaming.inherited)}`);
175
201
  for (const runtime of RUNTIME_DEFINITIONS) {
@@ -180,7 +206,6 @@ function printConfigView(config = loadPersistentConfig()) {
180
206
  for (const runtime of getRuntimeExecutableDefinitions()) {
181
207
  console.log(`${runtime.executableCliKey}=${config[runtime.executableConfigKey] || ''}`);
182
208
  }
183
- console.log(`telegram.bot-token=${config.TELEGRAM_BOT_TOKEN ? 'set' : 'unset'}`);
184
209
  console.log(`ticlawk.connector-api-key=${config[TICLAWK_CONNECTOR_API_KEY] ? 'set' : 'unset'}`);
185
210
  console.log(`ticlawk.api-url=${config.TICLAWK_API_URL || ''}`);
186
211
  console.log(`ticlawk.connector-ws-url=${config[TICLAWK_CONNECTOR_WS_URL] || ''}`);
@@ -211,7 +236,7 @@ function getLocal(path) {
211
236
  }
212
237
 
213
238
  function formatSecretConfigValue(configKey, value) {
214
- if (configKey === 'TELEGRAM_BOT_TOKEN' || configKey === TICLAWK_CONNECTOR_API_KEY) {
239
+ if (configKey === TICLAWK_CONNECTOR_API_KEY) {
215
240
  return value ? 'set' : 'unset';
216
241
  }
217
242
  return value || '';
@@ -302,6 +327,178 @@ async function main() {
302
327
  return;
303
328
  }
304
329
 
330
+ // ── Agent-facing subcommands (run inside a runtime; talk to local daemon) ──
331
+ if (command === 'message') {
332
+ const sub = args._[1];
333
+ if (args.help || args.h || !sub) {
334
+ console.log(AGENT_COMMAND_HELP.message);
335
+ return;
336
+ }
337
+ if (sub === 'send') {
338
+ process.exitCode = await runMessageSendCommand(args);
339
+ return;
340
+ }
341
+ if (sub === 'read') {
342
+ process.exitCode = await runMessageReadCommand(args);
343
+ return;
344
+ }
345
+ if (sub === 'react') {
346
+ process.exitCode = await runMessageReactCommand(args);
347
+ return;
348
+ }
349
+ if (sub === 'check') {
350
+ process.exitCode = await runMessageCheckCommand(args);
351
+ return;
352
+ }
353
+ if (sub === 'search') {
354
+ process.exitCode = await runMessageSearchCommand(args);
355
+ return;
356
+ }
357
+ console.error(`unknown message subcommand: ${sub}`);
358
+ process.exit(1);
359
+ }
360
+
361
+ if (command === 'profile') {
362
+ const sub = args._[1];
363
+ if (args.help || args.h || !sub) {
364
+ console.log(AGENT_COMMAND_HELP.profile);
365
+ return;
366
+ }
367
+ if (sub === 'show') {
368
+ process.exitCode = await runProfileShowCommand(args);
369
+ return;
370
+ }
371
+ if (sub === 'update') {
372
+ process.exitCode = await runProfileUpdateCommand(args);
373
+ return;
374
+ }
375
+ console.error(`unknown profile subcommand: ${sub}`);
376
+ process.exit(1);
377
+ }
378
+
379
+ if (command === 'reminder') {
380
+ const sub = args._[1];
381
+ if (args.help || args.h || !sub) {
382
+ console.log(AGENT_COMMAND_HELP.reminder);
383
+ return;
384
+ }
385
+ if (sub === 'schedule') {
386
+ process.exitCode = await runReminderScheduleCommand(args);
387
+ return;
388
+ }
389
+ if (sub === 'list') {
390
+ process.exitCode = await runReminderListCommand(args);
391
+ return;
392
+ }
393
+ if (sub === 'snooze') {
394
+ process.exitCode = await runReminderSnoozeCommand(args);
395
+ return;
396
+ }
397
+ if (sub === 'update') {
398
+ process.exitCode = await runReminderUpdateCommand(args);
399
+ return;
400
+ }
401
+ if (sub === 'cancel') {
402
+ process.exitCode = await runReminderCancelCommand(args);
403
+ return;
404
+ }
405
+ if (sub === 'log') {
406
+ process.exitCode = await runReminderLogCommand(args);
407
+ return;
408
+ }
409
+ console.error(`unknown reminder subcommand: ${sub}`);
410
+ process.exit(1);
411
+ }
412
+
413
+ if (command === 'attachment') {
414
+ const sub = args._[1];
415
+ if (args.help || args.h || !sub) {
416
+ console.log(AGENT_COMMAND_HELP.attachment);
417
+ return;
418
+ }
419
+ if (sub === 'upload') {
420
+ process.exitCode = await runAttachmentUploadCommand(args);
421
+ return;
422
+ }
423
+ if (sub === 'view') {
424
+ process.exitCode = await runAttachmentViewCommand(args);
425
+ return;
426
+ }
427
+ console.error(`unknown attachment subcommand: ${sub}`);
428
+ process.exit(1);
429
+ }
430
+
431
+ if (command === 'task') {
432
+ const sub = args._[1];
433
+ if (args.help || args.h || !sub) {
434
+ console.log(AGENT_COMMAND_HELP.task);
435
+ return;
436
+ }
437
+ if (sub === 'create') {
438
+ process.exitCode = await runTaskCreateCommand(args);
439
+ return;
440
+ }
441
+ if (sub === 'claim') {
442
+ process.exitCode = await runTaskClaimCommand(args);
443
+ return;
444
+ }
445
+ if (sub === 'unclaim') {
446
+ process.exitCode = await runTaskUnclaimCommand(args);
447
+ return;
448
+ }
449
+ if (sub === 'update') {
450
+ process.exitCode = await runTaskUpdateCommand(args);
451
+ return;
452
+ }
453
+ if (sub === 'list') {
454
+ process.exitCode = await runTaskListCommand(args);
455
+ return;
456
+ }
457
+ console.error(`unknown task subcommand: ${sub}`);
458
+ process.exit(1);
459
+ }
460
+
461
+ if (command === 'group') {
462
+ const sub = args._[1];
463
+ if (args.help || args.h || !sub) {
464
+ console.log(AGENT_COMMAND_HELP.group);
465
+ return;
466
+ }
467
+ if (sub === 'create') {
468
+ process.exitCode = await runGroupCreateCommand(args);
469
+ return;
470
+ }
471
+ if (sub === 'members') {
472
+ // Same subcommand handles list / add / remove based on flags.
473
+ if (args.add) {
474
+ process.exitCode = await runGroupMembersAddCommand(args);
475
+ return;
476
+ }
477
+ if (args.remove) {
478
+ process.exitCode = await runGroupMembersRemoveCommand(args);
479
+ return;
480
+ }
481
+ process.exitCode = await runGroupMembersCommand(args);
482
+ return;
483
+ }
484
+ console.error(`unknown group subcommand: ${sub}`);
485
+ process.exit(1);
486
+ }
487
+
488
+ if (command === 'server') {
489
+ const sub = args._[1];
490
+ if (args.help || args.h || !sub) {
491
+ console.log(AGENT_COMMAND_HELP.server);
492
+ return;
493
+ }
494
+ if (sub === 'info') {
495
+ process.exitCode = await runServerInfoCommand(args);
496
+ return;
497
+ }
498
+ console.error(`unknown server subcommand: ${sub}`);
499
+ process.exit(1);
500
+ }
501
+
305
502
  if (command === 'config') {
306
503
  const subcommand = args._[1];
307
504
  const config = loadPersistentConfig();
@@ -312,10 +509,6 @@ async function main() {
312
509
 
313
510
  if (subcommand === 'get') {
314
511
  const key = args._[2];
315
- if (key === 'adapter') {
316
- console.log(getConfiguredAdapter(config));
317
- return;
318
- }
319
512
  const adapterTarget = normalizeAdapterConfigTarget(key);
320
513
  if (adapterTarget) {
321
514
  console.log(formatSecretConfigValue(adapterTarget.configKey, config[adapterTarget.configKey]));
@@ -340,16 +533,6 @@ async function main() {
340
533
  if (subcommand === 'set') {
341
534
  const key = args._[2];
342
535
  const rawValue = args._[3];
343
- if (key === 'adapter') {
344
- if (!rawValue) {
345
- console.error('config set adapter requires a value');
346
- process.exit(1);
347
- }
348
- const adapterId = requireAdapter(rawValue);
349
- persistConfig({ [AF_ADAPTER_KEY]: adapterId });
350
- console.log(`adapter=${adapterId}`);
351
- return;
352
- }
353
536
  const adapterTarget = normalizeAdapterConfigTarget(key);
354
537
  if (adapterTarget) {
355
538
  if (!rawValue) {
@@ -464,9 +647,8 @@ async function main() {
464
647
  printHelp(['auth'], args);
465
648
  return;
466
649
  }
467
- const adapterId = requireAdapter(args._[1]);
468
- const adapterArgv = rawArgv.slice(2);
469
- const res = await runAdapterAuth(adapterId, adapterArgv);
650
+ const adapterArgv = rawArgv.slice(1);
651
+ const res = await runAdapterAuth('ticlawk', adapterArgv);
470
652
  printCommandResult(res);
471
653
  process.exitCode = res.statusCode >= 400 ? 1 : 0;
472
654
  return;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ticlawk",
3
- "version": "0.1.15",
4
- "description": "Connect local agent harnesses to Ticlawk, Telegram, and other mobile clients.",
3
+ "version": "0.1.16-dev.2",
4
+ "description": "Local connector that links agent harnesses (Claude Code, Codex, OpenClaw, opencode, Pi) to the Ticlawk mobile app.",
5
5
  "type": "module",
6
6
  "main": "ticlawk.mjs",
7
7
  "exports": {
@@ -48,9 +48,6 @@
48
48
  "codex",
49
49
  "agent",
50
50
  "ai-agent",
51
- "telegram",
52
- "telegram-bot",
53
- "chatops",
54
51
  "remote-agent",
55
52
  "mobile",
56
53
  "bridge",