INNER CODE UNIT · TypeScript
found
rowboatlabs/rowboat · apps/harbor/packages/server/src/connectors/agent37/index.ts:25
const found = instances.find((i) => i.id === target.instance);
if (!found) throw new HarborError('invalid_request', `This Agent37 key does not reach an instance ${target.instance ?? '(none named)'}`);
if (['failed', 'deleted', 'deleting'].includes(found.status)) throw new HarborError('invalid_request', `The Agent37 instance ${found.id} is ${found.status}`);
const runs = kindOfTemplate(found.template);
if (runs !== target.kind) {
throw new HarborError('invalid_request', `The Agent37 instance ${found.id} runs ${found.template || 'an unknown template'}, not ${target.kind}`);
}
},
setup: {
list: (secret) => listAgent37Instances(secret, fetch, base),
create: (secret, input) => createAgent37Instance(secret, input, fetch, base),
},
start(env) {
return new Agent37Connector(env, async () => agent37Api(await env.credential(), base, instance)).start();
},
};
}