ticlawk 0.1.13 → 0.1.14

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/README.md CHANGED
@@ -253,7 +253,7 @@ ticlawk connect
253
253
  systemd linger is off, it prints the same `Action required` message shown by
254
254
  the installer.
255
255
 
256
- Update with `ticlawk update`. To remove the service and legacy managed
256
+ Update with `ticlawk update`. To remove the service and managed
257
257
  install files while keeping `~/.ticlawk` config, bindings, profiles, and
258
258
  logs:
259
259
 
@@ -263,8 +263,8 @@ ticlawk uninstall
263
263
 
264
264
  That removes:
265
265
 
266
- - legacy `~/.local/share/ticlawk`
267
- - legacy `~/.local/bin/ticlawk`
266
+ - `~/.local/share/ticlawk`
267
+ - `~/.local/bin/ticlawk`
268
268
  - `~/.config/systemd/user/ticlawk.service` (Linux)
269
269
  - `~/Library/LaunchAgents/ticlawk.plist` (macOS)
270
270
 
@@ -340,7 +340,7 @@ Commands:
340
340
  profile list or switch saved local identities
341
341
  install-daemon install or refresh the background daemon
342
342
  update update the npm package and refresh the daemon
343
- uninstall remove service and legacy install files, preserving ~/.ticlawk
343
+ uninstall remove service and managed install files, preserving ~/.ticlawk
344
344
 
345
345
  Config examples:
346
346
  ticlawk config get adapter
package/bin/ticlawk.mjs CHANGED
@@ -8,7 +8,6 @@ import {
8
8
  getConfiguredAdapter,
9
9
  loadPersistentConfig,
10
10
  getStreamingConfigView,
11
- LEGACY_TICLAWK_API_KEY,
12
11
  normalizeAdapterConfigTarget,
13
12
  normalizeAdapterName,
14
13
  normalizeRuntimeConfigTarget,
@@ -109,7 +108,7 @@ Commands:
109
108
  profile list or switch saved local identities
110
109
  install-daemon install or refresh the background daemon
111
110
  update update the npm package and refresh the daemon
112
- uninstall remove service and legacy install files, preserving ~/.ticlawk
111
+ uninstall remove service and managed install files, preserving ~/.ticlawk
113
112
 
114
113
  Config examples:
115
114
  ticlawk config get adapter
@@ -227,7 +226,7 @@ function printConfigView(config = loadPersistentConfig()) {
227
226
  console.log(`${runtime.executableCliKey}=${config[runtime.executableConfigKey] || ''}`);
228
227
  }
229
228
  console.log(`telegram.bot-token=${config.TELEGRAM_BOT_TOKEN ? 'set' : 'unset'}`);
230
- console.log(`ticlawk.connector-api-key=${config[TICLAWK_CONNECTOR_API_KEY] || config[LEGACY_TICLAWK_API_KEY] ? 'set' : 'unset'}`);
229
+ console.log(`ticlawk.connector-api-key=${config[TICLAWK_CONNECTOR_API_KEY] ? 'set' : 'unset'}`);
231
230
  console.log(`ticlawk.api-url=${config.TICLAWK_API_URL || ''}`);
232
231
  console.log(`ticlawk.connector-ws-url=${config[TICLAWK_CONNECTOR_WS_URL] || ''}`);
233
232
  }
@@ -257,7 +256,7 @@ function getLocal(path) {
257
256
  }
258
257
 
259
258
  function formatSecretConfigValue(configKey, value) {
260
- if (configKey === 'TELEGRAM_BOT_TOKEN' || configKey === TICLAWK_CONNECTOR_API_KEY || configKey === LEGACY_TICLAWK_API_KEY) {
259
+ if (configKey === 'TELEGRAM_BOT_TOKEN' || configKey === TICLAWK_CONNECTOR_API_KEY) {
261
260
  return value ? 'set' : 'unset';
262
261
  }
263
262
  return value || '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ticlawk",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Connect local agent harnesses to Ticlawk, Telegram, and other mobile clients.",
5
5
  "type": "module",
6
6
  "main": "ticlawk.mjs",
@@ -22,16 +22,16 @@ function runSetupReadiness(cliScript) {
22
22
  if (process.env.npm_config_global === 'true') {
23
23
  const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
24
24
  const cliScript = join(packageRoot, 'bin', 'ticlawk.mjs');
25
- const legacyHome = join(homedir(), '.agent-freeway');
26
- const ticlawkHome = join(homedir(), '.ticlawk');
27
- const legacyConfigPath = join(legacyHome, '.config');
28
- const ticlawkConfigPath = join(ticlawkHome, '.config');
29
- if (existsSync(legacyConfigPath) && !existsSync(ticlawkConfigPath)) {
30
- if (existsSync(ticlawkHome)) {
31
- renameSync(ticlawkHome, `${ticlawkHome}.pre-migration.${Date.now()}`);
25
+ const oldDataHome = join(homedir(), '.agent-freeway');
26
+ const newDataHome = join(homedir(), '.ticlawk');
27
+ const oldConfigPath = join(oldDataHome, '.config');
28
+ const newConfigPath = join(newDataHome, '.config');
29
+ if (existsSync(oldConfigPath) && !existsSync(newConfigPath)) {
30
+ if (existsSync(newDataHome)) {
31
+ renameSync(newDataHome, `${newDataHome}.pre-migration.${Date.now()}`);
32
32
  }
33
- renameSync(legacyHome, ticlawkHome);
34
- console.log(`ticlawk: migrated ${legacyHome} to ${ticlawkHome}`);
33
+ renameSync(oldDataHome, newDataHome);
34
+ console.log(`ticlawk: migrated ${oldDataHome} to ${newDataHome}`);
35
35
  }
36
36
 
37
37
  runSetupReadiness(cliScript);
@@ -3,11 +3,10 @@
3
3
  *
4
4
  * The ticlawk connect flow returns a `tk_...` bearer key in response to
5
5
  * a local adapter connect call. We persist it to `~/.ticlawk/.config`
6
- * using the connector-specific env name so publisher scripts can keep using
7
- * `TICLAWK_API_KEY` without being polluted by ticlawk.
6
+ * using the connector-specific env name.
8
7
  */
9
8
 
10
- import { AF_ADAPTER_KEY, AF_CONFIG_PATH, LEGACY_TICLAWK_API_KEY, persistConfig, TICLAWK_CONNECTOR_API_KEY } from '../../core/config.mjs';
9
+ import { AF_ADAPTER_KEY, AF_CONFIG_PATH, persistConfig, TICLAWK_CONNECTOR_API_KEY } from '../../core/config.mjs';
11
10
 
12
11
  export function persistApiCredential(apiKey) {
13
12
  if (!apiKey || !apiKey.startsWith('tk_')) return;
@@ -15,11 +14,9 @@ export function persistApiCredential(apiKey) {
15
14
  persistConfig({
16
15
  [AF_ADAPTER_KEY]: 'ticlawk',
17
16
  [TICLAWK_CONNECTOR_API_KEY]: apiKey,
18
- [LEGACY_TICLAWK_API_KEY]: '',
19
17
  TICLAWK_SETUP_CODE: '',
20
18
  });
21
19
  process.env[TICLAWK_CONNECTOR_API_KEY] = apiKey;
22
- delete process.env[LEGACY_TICLAWK_API_KEY];
23
20
  delete process.env.TICLAWK_SETUP_CODE;
24
21
  console.log(`[connect] saved ${TICLAWK_CONNECTOR_API_KEY} to ${AF_CONFIG_PATH}`);
25
22
  }
@@ -2,7 +2,7 @@ import { parseOptionArgs } from '../../core/argv.mjs';
2
2
  import { createHash, randomBytes } from 'node:crypto';
3
3
  import { createRequire } from 'node:module';
4
4
  import { basename } from 'node:path';
5
- import { AF_ADAPTER_KEY, LEGACY_TICLAWK_API_KEY, loadPersistentConfig, persistConfig, TICLAWK_CONNECTOR_API_KEY, TICLAWK_CONNECTOR_WS_URL } from '../../core/config.mjs';
5
+ import { AF_ADAPTER_KEY, loadPersistentConfig, persistConfig, TICLAWK_CONNECTOR_API_KEY, TICLAWK_CONNECTOR_WS_URL } from '../../core/config.mjs';
6
6
  import { belongsToRuntimeHost, getBindingRuntimeHostId, getHostId, getHostLabel } from '../../core/host-id.mjs';
7
7
  import { debugError, debugLog } from '../../core/logger.mjs';
8
8
  import { getActiveProfile, ensureLegacyProfile, readProfileMeta, saveAndActivateProfile } from '../../core/profiles.mjs';
@@ -974,7 +974,7 @@ export function createTiclawkAdapter(ctx) {
974
974
  const runtimesHealth = Object.fromEntries(runtimeHealthEntries);
975
975
  const codexHealth = runtimesHealth.codex || {};
976
976
  return {
977
- apiKey: Boolean(process.env[TICLAWK_CONNECTOR_API_KEY] || config[TICLAWK_CONNECTOR_API_KEY] || config[LEGACY_TICLAWK_API_KEY]),
977
+ apiKey: Boolean(process.env[TICLAWK_CONNECTOR_API_KEY] || config[TICLAWK_CONNECTOR_API_KEY]),
978
978
  wakeUrl: api.getConnectorWsUrl(),
979
979
  wakeConnected: Boolean(connectorSocket?.isConnected()),
980
980
  wakeLastStatus: wakeState.lastStatus,
@@ -1014,7 +1014,7 @@ export function createTiclawkAdapter(ctx) {
1014
1014
  currentIdentity = readProfileMeta(activeProfile.adapter, activeProfile.userId) || {
1015
1015
  userId: activeProfile.userId,
1016
1016
  };
1017
- } else if (config[TICLAWK_CONNECTOR_API_KEY] || config[LEGACY_TICLAWK_API_KEY]) {
1017
+ } else if (config[TICLAWK_CONNECTOR_API_KEY]) {
1018
1018
  try {
1019
1019
  const me = await api.getMe();
1020
1020
  if (me?.userId || me?.user_id) {
@@ -3,11 +3,11 @@ import { AF_HOME } from '../config.mjs';
3
3
  import { JsonFileStore } from '../store/json-file-store.mjs';
4
4
  import { getActiveBindingsPath } from '../profiles.mjs';
5
5
 
6
- const LEGACY_BINDINGS_PATH = join(AF_HOME, 'bindings.json');
6
+ const ROOT_BINDINGS_PATH = join(AF_HOME, 'bindings.json');
7
7
  const stores = new Map();
8
8
 
9
9
  function getStore() {
10
- const filePath = getActiveBindingsPath(LEGACY_BINDINGS_PATH);
10
+ const filePath = getActiveBindingsPath(ROOT_BINDINGS_PATH);
11
11
  let store = stores.get(filePath);
12
12
  if (!store) {
13
13
  store = new JsonFileStore(filePath, []);
@@ -8,32 +8,12 @@
8
8
  */
9
9
 
10
10
  import dotenv from 'dotenv';
11
- import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
11
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
12
12
  import { homedir } from 'node:os';
13
13
  import { dirname, join } from 'node:path';
14
14
  import { RUNTIME_DEFINITIONS, normalizeServiceType } from './runtime-registry.mjs';
15
15
 
16
- const DEFAULT_TICLAWK_HOME = join(homedir(), '.ticlawk');
17
- const LEGACY_AGENT_FREEWAY_HOME = join(homedir(), '.agent-freeway');
18
-
19
- function migrateLegacyHomeIfNeeded() {
20
- const legacyConfigPath = join(LEGACY_AGENT_FREEWAY_HOME, '.config');
21
- const ticlawkConfigPath = join(DEFAULT_TICLAWK_HOME, '.config');
22
- if (!existsSync(legacyConfigPath)) return;
23
- if (existsSync(ticlawkConfigPath)) return;
24
- if (existsSync(DEFAULT_TICLAWK_HOME)) {
25
- renameSync(DEFAULT_TICLAWK_HOME, `${DEFAULT_TICLAWK_HOME}.pre-migration.${Date.now()}`);
26
- }
27
- renameSync(LEGACY_AGENT_FREEWAY_HOME, DEFAULT_TICLAWK_HOME);
28
- }
29
-
30
- function resolveTiclawkHome() {
31
- if (process.env.TICLAWK_HOME) return process.env.TICLAWK_HOME;
32
- migrateLegacyHomeIfNeeded();
33
- return DEFAULT_TICLAWK_HOME;
34
- }
35
-
36
- export const AF_HOME = resolveTiclawkHome();
16
+ export const AF_HOME = process.env.TICLAWK_HOME || join(homedir(), '.ticlawk');
37
17
  export const AF_CONFIG_PATH = join(AF_HOME, '.config');
38
18
  export const AF_LOG_PATH = join(AF_HOME, 'ticlawk.log');
39
19
  export const AF_CRASH_LOG_PATH = join(AF_HOME, 'ticlawk-crash.log');
@@ -46,7 +26,6 @@ export const AF_STREAMING_RUNTIME_KEYS = Object.fromEntries(
46
26
  );
47
27
  export const TICLAWK_CONNECTOR_API_KEY = 'TICLAWK_CONNECTOR_API_KEY';
48
28
  export const TICLAWK_CONNECTOR_WS_URL = 'TICLAWK_CONNECTOR_WS_URL';
49
- export const LEGACY_TICLAWK_API_KEY = 'TICLAWK_API_KEY';
50
29
  export const RUNTIME_EXECUTABLE_CONFIG_KEYS = Object.fromEntries(
51
30
  RUNTIME_DEFINITIONS
52
31
  .filter((runtime) => runtime.executableConfigKey)
@@ -137,25 +116,6 @@ export function persistConfig(updates) {
137
116
  }
138
117
  }
139
118
 
140
- export function migrateLegacyTiclawkConnectorKey() {
141
- const current = loadPersistentConfig();
142
- const legacyKey = current[LEGACY_TICLAWK_API_KEY];
143
- if (!legacyKey) return false;
144
-
145
- const updates = {
146
- [LEGACY_TICLAWK_API_KEY]: '',
147
- };
148
- if (!current[TICLAWK_CONNECTOR_API_KEY]) {
149
- updates[TICLAWK_CONNECTOR_API_KEY] = legacyKey;
150
- }
151
-
152
- persistConfig(updates);
153
- delete process.env[LEGACY_TICLAWK_API_KEY];
154
- return true;
155
- }
156
-
157
- migrateLegacyTiclawkConnectorKey();
158
-
159
119
  function parseBooleanish(value) {
160
120
  if (value === undefined || value === null || value === '') return null;
161
121
  const normalized = String(value).trim().toLowerCase();
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Service and legacy install cleanup.
2
+ * Service and managed install cleanup.
3
3
  *
4
- * Removes the user service and legacy managed-install files while preserving
4
+ * Removes the user service and managed-install files while preserving
5
5
  * ~/.ticlawk by default. The npm package is owned by npm.
6
6
  */
7
7
 
@@ -82,12 +82,12 @@ function uninstallLaunchd() {
82
82
  export function getUninstallHelp() {
83
83
  return `ticlawk uninstall
84
84
 
85
- Remove the ticlawk service and legacy install files while preserving local data.
85
+ Remove the ticlawk service and managed install files while preserving local data.
86
86
 
87
87
  Removes:
88
88
  - user service: systemd on Linux, launchd on macOS
89
89
  - CLI wrapper: ~/.local/bin/ticlawk
90
- - legacy managed install: ~/.local/share/ticlawk
90
+ - managed install files: ~/.local/share/ticlawk
91
91
 
92
92
  Preserves:
93
93
  - ~/.ticlawk
@@ -107,7 +107,7 @@ export async function runSelfUninstall(skipPrompt) {
107
107
 
108
108
  console.log('ticlawk uninstall');
109
109
  console.log('will remove the user service');
110
- console.log(`will remove legacy install files under: ${installRoot}`);
110
+ console.log(`will remove managed install files under: ${installRoot}`);
111
111
  console.log(`will remove CLI wrapper: ${wrapperPath}`);
112
112
  console.log(`will preserve data directory: ${AF_HOME}`);
113
113