@aglit-ai/cli 0.1.11 → 0.1.17070

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/aglit.cjs CHANGED
@@ -33,6 +33,8 @@ const help = `Aglit Computer Use
33
33
  aglit pipelines [--open]
34
34
  aglit providers
35
35
  aglit models list | choose
36
+ aglit models login copilot [--reauth] [--json]
37
+ aglit models login-status copilot --attempt ATTEMPT_ID [--json]
36
38
  aglit models publish | unpublish --connection CONNECTION_ID --model MODEL_ID
37
39
  aglit models register --device DEVICE_ID --fingerprint SHA256 [--name NAME]
38
40
  aglit models prefer CONNECTION_ID|auto
@@ -66,7 +68,7 @@ async function finishUninstall(receipt) {
66
68
  async function main() {
67
69
  const delegated = installation.development ? null : updates.delegate(__filename); if (delegated !== null) { process.exitCode = delegated; return; }
68
70
  const { values, positionals } = parseArgs({ options: {
69
- connections: { type: 'string' },
71
+ connections: { type: 'string' }, attempt: { type: 'string' }, reauth: {type:'boolean'},
70
72
  harness: { type: 'boolean' },
71
73
  device: { type: 'string' }, fingerprint: { type: 'string' }, challenge: { type: 'string' }, code: { type: 'string' }, connection: { type: 'string' }, model: { type: 'string' }, name: { type: 'string' }, provider: { type: 'string' }, account: { type: 'string' },
72
74
  team: { type: 'string' }, workspace: { type: 'string' }, check: { type: 'boolean' }, channel: { type: 'string' }, open: { type: 'boolean' }, json: { type: 'boolean' }, help: { type: 'boolean', short: 'h' },
@@ -75,7 +77,7 @@ async function main() {
75
77
  if (values.help || !positionals.length && !interactive) { process.stdout.write(help); return; }
76
78
  const [command = 'init', email, connectionId] = positionals;
77
79
  const options = {
78
- models: ['device','fingerprint','name','json','challenge','code','connection','connections','model','harness'],
80
+ models: ['device','fingerprint','name','json','challenge','code','connection','connections','model','harness','attempt','reauth'],
79
81
  install: ['json', 'channel'], init: ['name', 'provider', 'account', 'json', 'channel'],
80
82
  start: ['json', 'channel'], ui: ['json'], status: ['json'], update: ['check', 'channel', 'json'], updates: ['json'], enable: [], disable: [], rename: ['name', 'json'], console: ['json'], teams: ['json', 'open'], team: ['name', 'team', 'workspace', 'json'], pipelines: ['open', 'json'], providers: ['json'], invite: ['team'], uninstall: [],
81
83
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aglit-ai/cli",
3
- "version": "0.1.11",
3
+ "version": "0.1.17070",
4
4
  "description": "Install and manage Aglit Computer Use",
5
5
  "license": "UNLICENSED",
6
6
  "type": "commonjs",
package/src/control.cjs CHANGED
@@ -22,7 +22,7 @@ function control(configPath, action, fields = {}) {
22
22
  const id = crypto.randomUUID();
23
23
  const socket = net.createConnection(config.endpoint);
24
24
  let buffer = '', authenticated = false, settled = false;
25
- const timeout = setTimeout(() => finish(Error('Native command timed out; its outcome may be uncertain. Check aglit status before retrying.')), action === 'permissions' ? 5 * 60000 : ['enable','models-test'].includes(action) ? 120000 : 30000);
25
+ const timeout = setTimeout(() => finish(Error('Native command timed out; its outcome may be uncertain. Check aglit status before retrying.')), action === 'permissions' ? 5 * 60000 : ['enable','models-test','models-login'].includes(action) ? 120000 : 30000);
26
26
  const finish = (error, result) => {
27
27
  if (settled) return;
28
28
  settled = true; clearTimeout(timeout); socket.destroy();
@@ -51,9 +51,11 @@ async function chooseModelConnection(control, { provider, question } = {}) {
51
51
  return { view, connectionId: selection.connection_id };
52
52
  }
53
53
  function validateModelCommand(command, id, values) {
54
- const allowed = {list:['json'],test:['connection','model','harness'],choose:[],pool:['name','connections'],publish:['connection','model'],unpublish:['connection','model'],unserve:[],register:['device','fingerprint','name','challenge','code'],prefer:[],remove:[]};
54
+ const allowed = {list:['json'],login:['json','reauth'],'login-status':['attempt','json'],test:['connection','model','harness'],choose:[],pool:['name','connections'],publish:['connection','model'],unpublish:['connection','model'],unserve:[],register:['device','fingerprint','name','challenge','code'],prefer:[],remove:[]};
55
55
  if (!Object.hasOwn(allowed,command) || Object.keys(values).some(key=>!allowed[command].includes(key)) ||
56
- (!['prefer','remove','pool'].includes(command) && id) || (['prefer','remove','pool'].includes(command) && !id)) throw Error('Invalid model command or options');
56
+ (!['prefer','remove','pool','login','login-status'].includes(command) && id) || (['prefer','remove','pool','login','login-status'].includes(command) && !id)) throw Error('Invalid model command or options');
57
+ if(['login','login-status'].includes(command)&&(id!=='copilot'||command==='login-status'&&!/^[a-f0-9-]{36}$/.test(values.attempt??'')))throw Error('Use aglit models login copilot or aglit models login-status copilot --attempt ATTEMPT_ID');
58
+ if(values.reauth!==undefined&&values.reauth!==true)throw Error('Use --reauth only to explicitly replace the Copilot login');
57
59
  if (command === 'pool' && (!/^[A-Za-z0-9._-]{1,80}$/.test(id) || !values.name?.trim() || values.name.length > 100 ||
58
60
  typeof values.connections !== 'string' || values.connections.length > 6400 || !values.connections.split(',').every(value => /^local:[A-Za-z0-9._:-]{1,180}$/.test(value) && !value.startsWith('local:pool:'))))
59
61
  throw Error('Use aglit models pool POOL_ID --name NAME --connections local:ACCOUNT_A,local:ACCOUNT_B');
@@ -68,6 +70,7 @@ function validateModelCommand(command, id, values) {
68
70
  async function modelCommand(control, command, id, values, question) {
69
71
  validateModelCommand(command,id,values);
70
72
  if (command === 'list') return listModelConnections(control);
73
+ if(command==='login'||command==='login-status')return control(command==='login'?'models-login':'models-login-status',{provider_id:id,...(command==='login-status'?{attempt_id:values.attempt}:values.reauth?{reauth:'true'}:{})});
71
74
  if (command === 'test') {
72
75
  if (!/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,255}$/.test(values.model || '') || values.connection && !/^[A-Za-z0-9._:-]{1,200}$/.test(values.connection)) throw Error('Use aglit models test --model MODEL_ID [--connection CONNECTION_ID]');
73
76
  return control('models-test', { model_id: values.model, ...(values.connection ? { connection_id: values.connection } : {}), ...(values.harness ? { harness: 'true' } : {}) });